use of org.gephi.visualization.model.node.NodeModel in project gephi by gephi.
the class CompatibilityEngine method mouseDrag.
@Override
public void mouseDrag() {
if (vizConfig.isMouseSelectionUpdateWhileDragging()) {
mouseMove();
} else {
float[] drag = graphIO.getMouseDrag3d();
if (dragSelected != null) {
for (NodeModel obj : dragSelected) {
float[] mouseDistance = obj.getDragDistanceFromMouse();
obj.getNode().setX(drag[0] + mouseDistance[0]);
obj.getNode().setY(drag[1] + mouseDistance[1]);
}
}
}
}
use of org.gephi.visualization.model.node.NodeModel in project gephi by gephi.
the class CompatibilityEngine method updateLOD.
@Override
public void updateLOD() {
Iterator<NodeModel> iterator = octree.getNodeIterator();
for (; iterator.hasNext(); ) {
NodeModel obj = iterator.next();
nodeModeler.chooseModel(obj);
}
}
use of org.gephi.visualization.model.node.NodeModel in project gephi by gephi.
the class CompatibilityEngine method display.
@Override
public void display(GL2 gl, GLU glu) {
markTime++;
VizModel vizModel = VizController.getInstance().getVizModel();
//Edges
if (edgeModeler.isEnabled()) {
edgeModeler.beforeDisplay(gl, glu);
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.markTime != markTime) {
obj.display(gl, glu, vizModel);
obj.markTime = markTime;
}
}
edgeModeler.afterDisplay(gl, glu);
}
markTime++;
//Arrows
if (edgeModeler.isEnabled() && vizConfig.isShowArrows() && dataBridge.isDirected()) {
gl.glBegin(GL2.GL_TRIANGLES);
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.getEdge().isDirected() && obj.markTime != markTime) {
obj.displayArrow(gl, glu, vizModel);
obj.markTime = markTime;
}
}
gl.glEnd();
}
//Nodes
if (nodeModeler.isEnabled()) {
nodeModeler.beforeDisplay(gl, glu);
for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (obj.markTime != markTime) {
obj.display(gl, glu, vizModel);
obj.markTime = markTime;
}
}
nodeModeler.afterDisplay(gl, glu);
}
//Labels
if (vizModel.getTextModel().isShowNodeLabels() || vizModel.getTextModel().isShowEdgeLabels()) {
markTime++;
if (nodeModeler.isEnabled() && vizModel.getTextModel().isShowNodeLabels()) {
textManager.getNodeRenderer().beginRendering();
textManager.defaultNodeColor();
if (textManager.isSelectedOnly()) {
for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (obj.markTime != markTime) {
if (obj.isSelected() && obj.isTextVisible()) {
textManager.getNodeRenderer().drawTextNode(obj);
}
obj.markTime = markTime;
}
}
} else {
for (Iterator<NodeModel> itr = octree.getNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (obj.markTime != markTime) {
if (obj.isTextVisible()) {
textManager.getNodeRenderer().drawTextNode(obj);
}
obj.markTime = markTime;
}
}
}
textManager.getNodeRenderer().endRendering();
}
// }
if (edgeModeler.isEnabled() && vizModel.getTextModel().isShowEdgeLabels()) {
markTime++;
textManager.getEdgeRenderer().beginRendering();
textManager.defaultEdgeColor();
if (textManager.isSelectedOnly()) {
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.markTime != markTime) {
if ((obj.isSelected() || obj.isAutoSelected()) && obj.isTextVisible()) {
textManager.getEdgeRenderer().drawTextEdge(obj);
}
obj.markTime = markTime;
}
}
} else {
for (Iterator<EdgeModel> itr = octree.getEdgeIterator(); itr.hasNext(); ) {
EdgeModel obj = itr.next();
if (obj.markTime != markTime) {
if (obj.isTextVisible()) {
textManager.getEdgeRenderer().drawTextEdge(obj);
}
obj.markTime = markTime;
}
}
}
textManager.getEdgeRenderer().endRendering();
}
}
// octree.displayOctree(gl, glu);
}
use of org.gephi.visualization.model.node.NodeModel in project gephi by gephi.
the class CompatibilityEngine method mouseMove.
@Override
public void mouseMove() {
//Selection
if (vizConfig.isSelectionEnable() && rectangleSelection) {
Rectangle rectangle = (Rectangle) currentSelectionArea;
rectangle.setMousePosition(graphIO.getMousePosition(), graphIO.getMousePosition3d());
if (rectangle.isStop()) {
return;
}
}
if (customSelection || currentSelectionArea.blockSelection()) {
return;
}
if (!rectangleSelection && graphIO.isDragging()) {
return;
}
boolean someSelection = false;
for (Iterator<NodeModel> itr = octree.getSelectableNodeIterator(); itr.hasNext(); ) {
NodeModel obj = itr.next();
if (isUnderMouse(obj)) {
if (!obj.isSelected()) {
//New selected
obj.setSelected(true);
}
someSelection = true;
} else if (obj.isSelected()) {
obj.setSelected(false);
}
}
if (vizController.getVizModel().isLightenNonSelectedAuto()) {
if (vizConfig.isLightenNonSelectedAnimation()) {
if (!anySelected && someSelection) {
//Start animation
lightenAnimationDelta = 0.07f;
} else if (anySelected && !someSelection) {
//Stop animation
lightenAnimationDelta = -0.07f;
}
vizConfig.setLightenNonSelected(someSelection || lightenAnimationDelta != 0);
} else {
vizConfig.setLightenNonSelected(someSelection);
}
}
anySelected = someSelection;
}
use of org.gephi.visualization.model.node.NodeModel in project gephi by gephi.
the class CompatibilityEngine method startDrag.
@Override
public void startDrag() {
float x = graphIO.getMouseDrag3d()[0];
float y = graphIO.getMouseDrag3d()[1];
dragSelected = getSelectedNodes();
for (NodeModel selected : dragSelected) {
float[] tab = selected.getDragDistanceFromMouse();
tab[0] = selected.getNode().x() - x;
tab[1] = selected.getNode().y() - y;
}
}
Aggregations