use of easik.model.edge.TriangleEdge in project fql by CategoricalData.
the class ViewGraphModel method getAttributes.
/**
* Overridden method to get cell attributes; we make sure the appropriate
* attributes are applied to the Easik objects before returning them.
*
* @see DefaultGraphModel.getAttributes(Object)
*
* @param o
*
* @return
*/
@Override
@SuppressWarnings("unchecked")
public AttributeMap getAttributes(Object o) {
_mode = (_view.getSketch().getFrame().getMode() == Mode.EDIT) ? "edit_" : "manip_";
if (o instanceof GraphCell) {
GraphCell cell = (GraphCell) o;
AttributeMap attribs = cell.getAttributes();
AttributeMap easikAttribs = null;
if (cell instanceof View_Edge) {
easikAttribs = (cell instanceof InjectiveViewEdge) ? injectiveEdgeAttributes() : (cell instanceof PartialViewEdge) ? partialEdgeAttributes() : normalEdgeAttributes();
} else if (cell instanceof TriangleEdge) {
easikAttribs = triangleEdgeAttributes((TriangleEdge<ViewFrame, ViewGraphModel, View, QueryNode, View_Edge>) cell);
} else if (cell instanceof GuideEdge) {
easikAttribs = ((GuideEdge<ViewFrame, ViewGraphModel, View, QueryNode, View_Edge>) cell).isHighlighted() ? virtualHighlightedEdgeAttributes() : virtualEdgeAttributes();
} else if (cell instanceof ModelConstraint) {
easikAttribs = virtualVertexAttributes();
} else if (cell instanceof QueryNode) {
easikAttribs = vertexAttributes();
}
if (easikAttribs != null) {
if (_view.isCellSelected(cell)) {
Color selColor;
float lineWidth;
if (_view.getStateManager().peekState() instanceof GetPathState) {
selColor = getColor("path_selection");
lineWidth = getWidth("path_selection", 2);
} else {
selColor = getColor("selection");
lineWidth = getWidth("selection", 3);
}
int borderWidth = getIntWidth(_mode + ((cell instanceof ModelConstraint) ? "constraint" : "entity") + "_border", 1);
GraphConstants.setBorder(easikAttribs, BorderFactory.createLineBorder(selColor, borderWidth));
GraphConstants.setForeground(easikAttribs, selColor);
GraphConstants.setLineColor(easikAttribs, selColor);
GraphConstants.setLineWidth(easikAttribs, lineWidth);
}
if (attribs == null) {
cell.setAttributes(easikAttribs);
attribs = easikAttribs;
} else {
attribs.applyMap(easikAttribs);
}
return attribs;
}
}
return super.getAttributes(o);
}
use of easik.model.edge.TriangleEdge in project fql by CategoricalData.
the class SketchGraphModel method getAttributes.
/**
* Overridden method to get cell attributes; we make sure the appropriate
* attributes are applied to the Easik objects before returning them.
*
* @see DefaultGraphModel.getAttributes(Object)
*
* @param o
*
* @return
*/
@Override
@SuppressWarnings("unchecked")
public AttributeMap getAttributes(Object o) {
_mode = (_sketch.getFrame().getMode() == Mode.EDIT) ? "edit_" : "manip_";
if (o instanceof GraphCell) {
GraphCell cell = (GraphCell) o;
AttributeMap attribs = cell.getAttributes();
AttributeMap easikAttribs = null;
if (cell instanceof SketchEdge) {
easikAttribs = (cell instanceof InjectiveEdge) ? injectiveEdgeAttributes() : (cell instanceof PartialEdge) ? partialEdgeAttributes() : normalEdgeAttributes();
} else if (cell instanceof TriangleEdge) {
easikAttribs = triangleEdgeAttributes((TriangleEdge<SketchFrame, SketchGraphModel, Sketch, EntityNode, SketchEdge>) cell);
} else if (cell instanceof GuideEdge) {
easikAttribs = ((GuideEdge<SketchFrame, SketchGraphModel, Sketch, EntityNode, SketchEdge>) cell).isHighlighted() ? virtualHighlightedEdgeAttributes() : virtualEdgeAttributes();
} else if (cell instanceof ModelConstraint) {
easikAttribs = virtualVertexAttributes();
} else if (cell instanceof EntityNode) {
easikAttribs = vertexAttributes();
}
if (easikAttribs != null) {
if (_sketch.isCellSelected(cell)) {
Color selColor;
float lineWidth;
if (_sketch.getStateManager().peekState() instanceof GetPathState) {
selColor = getColor("path_selection");
lineWidth = getWidth("path_selection", 2);
} else {
selColor = getColor("selection");
lineWidth = getWidth("selection", 3);
}
int borderWidth = getIntWidth(_mode + ((cell instanceof ModelConstraint) ? "constraint" : "entity") + "_border", 1);
GraphConstants.setBorder(easikAttribs, BorderFactory.createLineBorder(selColor, borderWidth));
GraphConstants.setForeground(easikAttribs, selColor);
GraphConstants.setLineColor(easikAttribs, selColor);
GraphConstants.setLineWidth(easikAttribs, lineWidth);
}
if (attribs == null) {
cell.setAttributes(easikAttribs);
attribs = easikAttribs;
} else {
attribs.applyMap(easikAttribs);
}
return attribs;
}
}
return super.getAttributes(o);
}
Aggregations