当前位置: 首页>>代码示例>>Java>>正文


Java ShapeTransformer.transform方法代码示例

本文整理汇总了Java中edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer.transform方法的典型用法代码示例。如果您正苦于以下问题:Java ShapeTransformer.transform方法的具体用法?Java ShapeTransformer.transform怎么用?Java ShapeTransformer.transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer的用法示例。


在下文中一共展示了ShapeTransformer.transform方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
	ShapeTransformer masterViewTransformer = master.getRenderContext()
			.getMultiLayerTransformer().getTransformer(Layer.VIEW);
	ShapeTransformer masterLayoutTransformer = master
			.getRenderContext().getMultiLayerTransformer()
			.getTransformer(Layer.LAYOUT);
	ShapeTransformer vvLayoutTransformer = vv.getRenderContext()
			.getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

	// changed: bounds without offset
	Shape lens = new Rectangle(new Point(), master.getSize());

	lens = masterViewTransformer.inverseTransform(lens);
	lens = masterLayoutTransformer.inverseTransform(lens);
	lens = vvLayoutTransformer.transform(lens);
	Graphics2D g2d = (Graphics2D) g;
	Color old = g.getColor();
	Color lensColor = master.getBackground();
	vv.setBackground(lensColor.darker());
	g.setColor(lensColor);
	g2d.fill(lens);
	g.setColor(Color.gray);
	g2d.draw(lens);
	g.setColor(old);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:27,代码来源:MySatelliteVisualizationViewer.java

示例2: paint

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
    ShapeTransformer masterViewTransformer = master.getRenderContext()
            .getMultiLayerTransformer().getTransformer(Layer.VIEW);
    ShapeTransformer masterLayoutTransformer = master
            .getRenderContext().getMultiLayerTransformer()
            .getTransformer(Layer.LAYOUT);
    ShapeTransformer vvLayoutTransformer = vv.getRenderContext()
            .getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

    // changed: bounds without offset
    Shape lens = new Rectangle(new Point(), master.getSize());

    lens = masterViewTransformer.inverseTransform(lens);
    lens = masterLayoutTransformer.inverseTransform(lens);
    lens = vvLayoutTransformer.transform(lens);
    Graphics2D g2d = (Graphics2D) g;
    Color old = g.getColor();
    Color lensColor = master.getBackground();
    vv.setBackground(lensColor.darker());
    g.setColor(lensColor);
    g2d.fill(lens);
    g.setColor(Color.gray);
    g2d.draw(lens);
    g.setColor(old);
}
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:27,代码来源:MySatelliteVisualizationViewer.java

示例3: paint

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
public void paint(Graphics g) {
    ShapeTransformer masterViewTransformer = 
    	master.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
    ShapeTransformer masterLayoutTransformer = master.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
    ShapeTransformer vvLayoutTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

    Shape lens = master.getBounds();
    lens = masterViewTransformer.inverseTransform(lens);
    lens = masterLayoutTransformer.inverseTransform(lens);
    lens = vvLayoutTransformer.transform(lens);
    Graphics2D g2d = (Graphics2D)g;
    Color old = g.getColor();
    Color lensColor = master.getBackground();
    vv.setBackground(lensColor.darker());
    g.setColor(lensColor);
    g2d.fill(lens);
    g.setColor(Color.gray);
    g2d.draw(lens);
    g.setColor(old);
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:21,代码来源:SatelliteVisualizationViewer.java

示例4: paint

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
public void paint(Graphics g) {
    ShapeTransformer masterViewTransformer = master.getViewTransformer();
    ShapeTransformer masterLayoutTransformer = master.getLayoutTransformer();
    ShapeTransformer vvLayoutTransformer = vv.getLayoutTransformer();

    Shape lens = master.getBounds();
    lens = masterViewTransformer.inverseTransform(lens);
    lens = masterLayoutTransformer.inverseTransform(lens);
    lens = vvLayoutTransformer.transform(lens);
    Graphics2D g2d = (Graphics2D)g;
    Color old = g.getColor();
    Color lensColor = master.getBackground();
    vv.setBackground(lensColor.darker());
    g.setColor(lensColor);
    g2d.fill(lens);
    g.setColor(Color.gray);
    g2d.draw(lens);
    g.setColor(old);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:20,代码来源:SatelliteVisualizationViewer.java

示例5: labelVertex

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
/**
 * Labels the specified vertex with the specified label. Uses the font specified by this
 * instance's <code>VertexFontFunction</code>. (If the font is unspecified, the existing font
 * for the graphics context is used.) If vertex label centering is active, the label is centered
 * on the position of the vertex; otherwise the label is offset slightly.
 */
@Override
public void labelVertex(RenderContext<V, E> rc, Layout<V, E> layout, V v, String label) {
	Graph<V, E> graph = layout.getGraph();
	if (rc.getVertexIncludePredicate().evaluate(Context.<Graph<V, E>, V> getInstance(graph, v)) == false) {
		return;
	}
	Point2D pt = layout.transform(v);
	pt = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, pt);

	float x = (float) pt.getX();
	float y = (float) pt.getY();

	Component component = prepareRenderer(rc, rc.getVertexLabelRenderer(), label, rc.getPickedVertexState().isPicked(v),
			v);
	GraphicsDecorator g = rc.getGraphicsContext();
	Dimension d = component.getPreferredSize();
	AffineTransform xform = AffineTransform.getTranslateInstance(x, y);

	Shape shape = rc.getVertexShapeTransformer().transform(v);
	shape = xform.createTransformedShape(shape);
	if (rc.getGraphicsContext() instanceof TransformingGraphics) {
		BidirectionalTransformer transformer = ((TransformingGraphics) rc.getGraphicsContext()).getTransformer();
		if (transformer instanceof ShapeTransformer) {
			ShapeTransformer shapeTransformer = (ShapeTransformer) transformer;
			shape = shapeTransformer.transform(shape);
		}
	}
	Rectangle2D bounds = shape.getBounds2D();

	Point p = null;
	if (position == Position.AUTO) {
		Dimension vvd = rc.getScreenDevice().getSize();
		if (vvd.width == 0 || vvd.height == 0) {
			vvd = rc.getScreenDevice().getPreferredSize();
		}
		p = getAnchorPoint(bounds, d, positioner.getPosition(x, y, vvd));
	} else {
		p = getAnchorPoint(bounds, d, position);
	}

	if (graphCreator.isLeaf((String) v)) {
		p.setLocation(p.x, p.y + LABEL_OFFSET_Y);
	}
	g.draw(component, rc.getRendererPane(), p.x, p.y, d.width, d.height, true);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:52,代码来源:TreeModelNodeLabelRenderer.java

示例6: labelVertex

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
/**
 * Labels the specified vertex with the specified label. Uses the font specified by this
 * instance's <code>VertexFontFunction</code>. (If the font is unspecified, the existing font
 * for the graphics context is used.) If vertex label centering is active, the label is centered
 * on the position of the vertex; otherwise the label is offset slightly.
 */
@Override
public void labelVertex(RenderContext<V, E> rc, Layout<V, E> layout, V v, String label) {
	Graph<V, E> graph = layout.getGraph();
	if (rc.getVertexIncludePredicate().evaluate(Context.<Graph<V, E>, V> getInstance(graph, v)) == false) {
		return;
	}
	Point2D pt = layout.transform(v);
	pt = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, pt);

	float x = (float) pt.getX();
	float y = (float) pt.getY();

	Component component = prepareRenderer(rc, rc.getVertexLabelRenderer(), label, rc.getPickedVertexState().isPicked(v),
			v);
	GraphicsDecorator g = rc.getGraphicsContext();
	Dimension d = component.getPreferredSize();
	AffineTransform xform = AffineTransform.getTranslateInstance(x, y);

	Shape shape = rc.getVertexShapeTransformer().transform(v);
	shape = xform.createTransformedShape(shape);
	if (rc.getGraphicsContext() instanceof TransformingGraphics) {
		BidirectionalTransformer transformer = ((TransformingGraphics) rc.getGraphicsContext()).getTransformer();
		if (transformer instanceof ShapeTransformer) {
			ShapeTransformer shapeTransformer = (ShapeTransformer) transformer;
			shape = shapeTransformer.transform(shape);
		}
	}
	Rectangle2D bounds = shape.getBounds2D();

	Point p = null;
	if (position == Position.AUTO) {
		Dimension vvd = rc.getScreenDevice().getSize();
		if (vvd.width == 0 || vvd.height == 0) {
			vvd = rc.getScreenDevice().getPreferredSize();
		}
		p = getAnchorPoint(bounds, d, positioner.getPosition(x, y, vvd));
	} else {
		p = getAnchorPoint(bounds, d, position);
	}

	if (graphCreator.isLeaf((String) v) && !graphCreator.getModel().getRoot().isNumerical()) {
		// shift the label if there is a frequency bar
		p.setLocation(p.x, p.y + LEAF_LABEL_OFFSET_Y);
	}
	g.draw(component, rc.getRendererPane(), p.x, p.y, d.width, d.height, true);
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:53,代码来源:TreeModelNodeLabelRenderer.java

示例7: paint

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
public void paint(Graphics g) {
    ShapeTransformer masterViewTransformer = master.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW);
    ShapeTransformer masterLayoutTransformer = master.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);
    ShapeTransformer vvLayoutTransformer = vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT);

    Rectangle rect = master.getBounds();
    GeneralPath path = new GeneralPath();
    path.moveTo(rect.x, rect.y);
    path.lineTo(rect.width,rect.y);
    path.lineTo(rect.width, rect.height);
    path.lineTo(rect.x, rect.height);
    path.lineTo(rect.x, rect.y);
    
    for(int i=0; i<=rect.width; i+=rect.width/10) {
    		path.moveTo(rect.x+i, rect.y);
    		path.lineTo(rect.x+i, rect.height);
    }
    for(int i=0; i<=rect.height; i+=rect.height/10) {
    		path.moveTo(rect.x, rect.y+i);
    		path.lineTo(rect.width, rect.y+i);
    }
    Shape lens = path;
    lens = masterViewTransformer.inverseTransform(lens);
    lens = masterLayoutTransformer.inverseTransform(lens);
    lens = vvLayoutTransformer.transform(lens);
    Graphics2D g2d = (Graphics2D)g;
    Color old = g.getColor();
    g.setColor(Color.cyan);
    g2d.draw(lens);
    
    path = new GeneralPath();
    path.moveTo((float)rect.getMinX(), (float)rect.getCenterY());
    path.lineTo((float)rect.getMaxX(), (float)rect.getCenterY());
    path.moveTo((float)rect.getCenterX(), (float)rect.getMinY());
    path.lineTo((float)rect.getCenterX(), (float)rect.getMaxY());
    Shape crosshairShape = path;
    crosshairShape = masterViewTransformer.inverseTransform(crosshairShape);
    crosshairShape = masterLayoutTransformer.inverseTransform(crosshairShape);
    crosshairShape = vvLayoutTransformer.transform(crosshairShape);
    g.setColor(Color.black);
    g2d.setStroke(new BasicStroke(3));
    g2d.draw(crosshairShape);
    
    g.setColor(old);
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:46,代码来源:SatelliteViewDemo.java

示例8: labelVertex

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
/**
* Labels the specified vertex with the specified label.  
* Uses the font specified by this instance's 
* <code>VertexFontFunction</code>.  (If the font is unspecified, the existing
* font for the graphics context is used.)  If vertex label centering
* is active, the label is centered on the position of the vertex; otherwise
   * the label is offset slightly.
   */
  public void labelVertex(RenderContext<V,E> rc, Layout<V,E> layout, V v, String label) {
  	Graph<V,E> graph = layout.getGraph();
      if (rc.getVertexIncludePredicate().evaluate(Context.<Graph<V,E>,V>getInstance(graph,v)) == false) {
      	return;
      }
      Point2D pt = layout.transform(v);
      pt = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, pt);

      float x = (float) pt.getX();
      float y = (float) pt.getY();

      Component component = prepareRenderer(rc, rc.getVertexLabelRenderer(), label,
      		rc.getPickedVertexState().isPicked(v), v);
      GraphicsDecorator g = rc.getGraphicsContext();
      Dimension d = component.getPreferredSize();
      AffineTransform xform = AffineTransform.getTranslateInstance(x, y);
      
  	Shape shape = rc.getVertexShapeTransformer().transform(v);
  	shape = xform.createTransformedShape(shape);
  	if(rc.getGraphicsContext() instanceof TransformingGraphics) {
  		BidirectionalTransformer transformer = ((TransformingGraphics)rc.getGraphicsContext()).getTransformer();
  		if(transformer instanceof ShapeTransformer) {
  			ShapeTransformer shapeTransformer = (ShapeTransformer)transformer;
  			shape = shapeTransformer.transform(shape);
  		}
  	}
  	Rectangle2D bounds = shape.getBounds2D();

  	Point p = null;
  	if(position == Position.AUTO) {
  		Dimension vvd = rc.getScreenDevice().getSize();
  		if(vvd.width == 0 || vvd.height == 0) {
  			vvd = rc.getScreenDevice().getPreferredSize();
  		}
  		p = getAnchorPoint(bounds, d, positioner.getPosition(x, y, vvd));
  	} else {
  		p = getAnchorPoint(bounds, d, position);
  	}
      g.draw(component, rc.getRendererPane(), p.x, p.y, d.width, d.height, true);
  }
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:49,代码来源:BasicVertexLabelRenderer.java

示例9: labelVertex

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
/**
 * Labels the specified vertex with the specified label.  
 * Uses the font specified by this instance's 
 * <code>VertexFontFunction</code>.  (If the font is unspecified, the existing
 * font for the graphics context is used.)  If vertex label centering
 * is active, the label is centered on the position of the vertex; otherwise
 * the label is offset slightly.
 */
public void labelVertex(RenderContext<V,E> rc, Layout<V,E> layout, V v, String label) {
    Graph<V,E> graph = layout.getGraph();
    if (rc.getVertexIncludePredicate().evaluate(Context.<Graph<V,E>,V>getInstance(graph,v)) == false) {
        return;
    }
    Point2D pt = layout.transform(v);
    pt = rc.getMultiLayerTransformer().transform(Layer.LAYOUT, pt);

    float x = (float) pt.getX();
    float y = (float) pt.getY();

    Component component = prepareRenderer(rc, rc.getVertexLabelRenderer(), label,
            rc.getPickedVertexState().isPicked(v), v);
    GraphicsDecorator g = rc.getGraphicsContext();
    Dimension d = component.getPreferredSize();
    AffineTransform xform = AffineTransform.getTranslateInstance(x, y);
    
    Shape shape = rc.getVertexShapeTransformer().transform(v);
    shape = xform.createTransformedShape(shape);
    if(rc.getGraphicsContext() instanceof TransformingGraphics) {
        BidirectionalTransformer transformer = ((TransformingGraphics)rc.getGraphicsContext()).getTransformer();
        if(transformer instanceof ShapeTransformer) {
            ShapeTransformer shapeTransformer = (ShapeTransformer)transformer;
            shape = shapeTransformer.transform(shape);
        }
    }
    Rectangle2D bounds = shape.getBounds2D();

    Point p = null;
    if(position == Position.AUTO) {
        Dimension vvd = rc.getScreenDevice().getSize();
        if(vvd.width == 0 || vvd.height == 0) {
            vvd = rc.getScreenDevice().getPreferredSize();
        }
        p = getAnchorPoint(bounds, d, positioner.getPosition(x, y, vvd));
    } else {
        p = getAnchorPoint(bounds, d, position);
    }
    
    if (graphCreator.isLeaf((String)v)) {
        p.setLocation(p.x, p.y + LABEL_OFFSET_Y);
    }
    g.draw(component, rc.getRendererPane(), p.x, p.y, d.width, d.height, true);        
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:53,代码来源:TreeModelNodeLabelRenderer.java

示例10: paint

import edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer; //导入方法依赖的package包/类
public void paint(Graphics g) {
    ShapeTransformer masterViewTransformer = master.getViewTransformer();
    ShapeTransformer masterLayoutTransformer = master.getLayoutTransformer();
    ShapeTransformer vvLayoutTransformer = vv.getLayoutTransformer();

    Rectangle rect = master.getBounds();
    GeneralPath path = new GeneralPath();
    path.moveTo(rect.x, rect.y);
    path.lineTo(rect.width,rect.y);
    path.lineTo(rect.width, rect.height);
    path.lineTo(rect.x, rect.height);
    path.lineTo(rect.x, rect.y);
    
    for(int i=0; i<=rect.width; i+=rect.width/10) {
    		path.moveTo(rect.x+i, rect.y);
    		path.lineTo(rect.x+i, rect.height);
    }
    for(int i=0; i<=rect.height; i+=rect.height/10) {
    		path.moveTo(rect.x, rect.y+i);
    		path.lineTo(rect.width, rect.y+i);
    }
    Shape lens = path;
    lens = masterViewTransformer.inverseTransform(lens);
    lens = masterLayoutTransformer.inverseTransform(lens);
    lens = vvLayoutTransformer.transform(lens);
    Graphics2D g2d = (Graphics2D)g;
    Color old = g.getColor();
    g.setColor(Color.cyan);
    g2d.draw(lens);
    
    path = new GeneralPath();
    path.moveTo((float)rect.getMinX(), (float)rect.getCenterY());
    path.lineTo((float)rect.getMaxX(), (float)rect.getCenterY());
    path.moveTo((float)rect.getCenterX(), (float)rect.getMinY());
    path.lineTo((float)rect.getCenterX(), (float)rect.getMaxY());
    Shape crosshairShape = path;
    crosshairShape = masterViewTransformer.inverseTransform(crosshairShape);
    crosshairShape = masterLayoutTransformer.inverseTransform(crosshairShape);
    crosshairShape = vvLayoutTransformer.transform(crosshairShape);
    g.setColor(Color.black);
    g2d.setStroke(new BasicStroke(3));
    g2d.draw(crosshairShape);
    
    g.setColor(old);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:46,代码来源:SatelliteViewDemo.java


注:本文中的edu.uci.ics.jung.visualization.transform.shape.ShapeTransformer.transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。