Skip to content

Commit

Permalink
added two more presets
Browse files Browse the repository at this point in the history
  • Loading branch information
brandmaier committed Dec 22, 2023
1 parent 8f87e67 commit 62e1542
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/gui/graph/presets/Camouflage.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void apply(Graph graph, Node node) {
node.nodeFillGradient = FillStyle.GRADIENT;
node.setLineColor(Color.black);
node.setShadow(true);
node.setShadow_type(0);
node.setFontColor(Color.black);
node.setFontSize(10);
node.setRough(false);
Expand Down
126 changes: 126 additions & 0 deletions src/gui/graph/presets/Celestial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Copyright 2023 by Timo von Oertzen and Andreas M. Brandmaier
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package gui.graph.presets;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;

import gui.fancy.PaintTricks;
import gui.graph.Edge;
import gui.graph.Edge.EdgeStyle;
import gui.graph.FillStyle;
import gui.graph.Graph;
import gui.graph.Node;
import gui.graph.NodeDrawProxy;


public class Celestial extends Preset {


Color gold = PaintTricks.hexToColor("#FFD700");
Color midnight = PaintTricks.hexToColor("#13294B");
//Color transp = new Color(0,0,0,0);
float strokeWidth = 2.5f;

@Override
public void apply(Graph graph)
{
super.apply(graph);
graph.backgroundColor = midnight;
}

@Override
public String getName() {
return "Celestial";
}

@Override
public void apply(Graph graph, Node node) {

node.setStrokeWidth(strokeWidth);

//node.setFillColor(transp);
node.setLineColor(gold);
node.setStrokeWidth(1);

node.nodeFillGradient = FillStyle.NONE;

node.setShadow(false);
node.setFontColor(gold);
node.setFontSize(10);
node.setRough(false);

node.setShadow_type(2);

//node.setDrawProxy( getNodeDrawProxy() );
}

private NodeDrawProxy ndp;

private NodeDrawProxy getNodeDrawProxy() {
if (ndp==null) {
ndp = new NodeDrawProxy() {

@Override
public void draw(Node node, Graphics2D g, boolean markUnconnectedNodes) {

/* Shape shape;
// determine shape
if (node.isMeanTriangle()) {
shape = new Polygon(new int[] { node.getX(), node.getX() + node.getWidth() / 2, node.getX() + node.width },
new int[] { node.y + node.height, node.y, node.y + node.height }, 3);
} else {
if (node.isLatent()) {
shape = new Ellipse2D.Double(node.x, node.y, node.width, node.height);
} else {
shape = new Rectangle(node.x, node.y, node.width, node.height);
}
}
*/
}
};
}

return(ndp);

}

@Override
public void apply(Graph graph, Edge edge) {
edge.setLineWidth(strokeWidth);
edge.setArrowStyle(1);
edge.setLineColor(gold);
edge.setDashStyle(null);
/*if (edge.target==edge.source) {
edge.setLineColor(Color.gray);
}*/

edge.setEdgeStyle(EdgeStyle.NORMAL);

edge.getLabel().setFontSize(9);

edge.getLabel().setColor(gold);

}

}
2 changes: 1 addition & 1 deletion src/gui/graph/presets/FadedColors.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void init(Graph graph)
public void apply(Graph graph, Node node) {

node.setRough(false);

node.setShadow(false);

if (node.isLatent()) {
node.setFillColor( colmap.get(node) );
Expand Down
1 change: 1 addition & 0 deletions src/gui/graph/presets/Gray.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public void apply(Graph graph, Node node) {
node.setLineColor(Color.black);
node.setFontColor(Color.black);
node.setShadow(true);
node.setShadow_type(0);
node.setFontSize(10);
node.setRough(false);
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/graph/presets/Happy.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void apply(Graph graph, Node node) {
}

node.setShadow(true);
node.setShadow_type(0);
node.setFontColor(Color.black);
node.setFontSize(10);
node.setRough(false);
Expand Down
1 change: 1 addition & 0 deletions src/gui/graph/presets/Metal.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public void apply(Graph graph, Node node) {
}

node.setShadow(true);
node.setShadow_type(0);
node.setRough(false);
node.setFontSize(10);

Expand Down
2 changes: 1 addition & 1 deletion src/gui/graph/presets/RetroOrange.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void apply(Graph graph, Node node) {

node.nodeFillGradient = FillStyle.GRADIENT;
node.setShadow(true);

node.setShadow_type(0);
node.setRough(false);

}
Expand Down
4 changes: 3 additions & 1 deletion src/gui/views/ModelView.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
import gui.graph.presets.FlatRainbow;
import gui.graph.presets.RetroOrange;
import gui.graph.presets.Camouflage;
import gui.graph.presets.Celestial;
import gui.graph.presets.Julian;
import gui.graph.presets.Modern;
import gui.graph.presets.Mint;
Expand Down Expand Up @@ -288,7 +289,7 @@ public static enum showPolicyType {
public final static int THINSTROKE = 0, MEDIUMSTROKE = 1, THICKSTROKE = 2;

static {
presets = new Preset[17];
presets = new Preset[18];
presets[0] = new Default();

presets[1] = new Modern();
Expand All @@ -308,6 +309,7 @@ public static enum showPolicyType {
presets[14] = new Mint();
presets[15] = new Posh();
presets[16] = new Comic();
presets[17] = new Celestial();
/*
* presets[16] = new Amelie();
*/
Expand Down

0 comments on commit 62e1542

Please sign in to comment.