Examples of DragLabel


Examples of bnGUI.venn.geometry.DragLabel

        ((VennDiagramView) views[i]).removeLabelListeners();
       
        Component[] comps = ((VennDiagramView) views[i]).getComponents();
        for (Component comp : comps) {
          if (comp instanceof DragLabel) {
            final DragLabel label = (DragLabel) comp;
            final BitSet path = label.getPath();
            final BitSet filteredModelPath = dataSplitter.getModels()[i].localToGlobalGroupID(path);
            final BitSet sourceModelPath = filteredModel.localToGlobalGroupID(filteredModelPath);
           
            label.setPath(sourceModelPath);
            label.setTransformer(null);
            assert ! labels.contains(label);
            labels.add(label);
          }
        }
      }
View Full Code Here

Examples of bnGUI.venn.geometry.DragLabel

        final BitSet groups = model.getGroups();
        final BitSet ggroups = filteredModel.localToGlobalGroupID(groups);

        //search label
        for (int k = 0; k < labels.size(); k++) {
          DragLabel label = labels.get(k);
          if (label == null) continue;

          BitSet ggroupsAndLabelPath = (BitSet) ggroups.clone();
          ggroupsAndLabelPath.and(label.getPath());
          if (label.getPath().cardinality() == ggroupsAndLabelPath.cardinality()) {
            //label found for this model (label path has no groups which don't exist in model)
           
            BitSet glabelPath = filteredModel.globalToLocalGroupID(label.getPath());
            label.setPath(model.globalToLocalGroupID(glabelPath));

            ((VennDiagramView) views[i]).add(label);
            labels.set(k, null);
          }
        }
View Full Code Here

Examples of bnGUI.venn.geometry.DragLabel

   
    public void labelsSetTransformerAndListeners() {
      Component[] comps = getComponents();
      for (Component comp : comps) {
        if (comp instanceof DragLabel) {
          DragLabel label = (DragLabel) comp;
          label.setTransformer(getTransformer());
          assert label.getMouseListeners().length == 0;
          label.addMouseListener(this);
          assert label.getMouseMotionListeners().length == 0;
          label.addMouseMotionListener(this);
        }
      }
    }
View Full Code Here

Examples of bnGUI.venn.geometry.DragLabel

   
    public void removeLabelListeners() {
      Component[] comps = getComponents();
      for (Component comp : comps) {
        if (comp instanceof DragLabel) {
          DragLabel label = (DragLabel) comp;
                label.removeMouseListener(this);
                label.removeMouseMotionListener(this);
        }
      }
    }
View Full Code Here

Examples of bnGUI.venn.geometry.DragLabel

        Component[] comp = getComponents();
        for( int i=0; i<comp.length; ++i )
        {
            if( comp[i] instanceof DragLabel )
            {
                DragLabel label = (DragLabel)comp[i];
               
                if( label.getWithConnector() )
                { // draw connection line
                    IntersectionTreeNode node = tree.getByPath(label.getPath());
                    if( node != null && node.vennObject != null && !node.vennObject.isEmpty() )
                    {
                      FRectangle rect = label.getBoundaries(g);
                        Assert.assertNotNull(rect);
                       
                        FSegment seg = new FSegment(node.vennObject.getCenter(),rect.center());
                        Assert.assertNotNull( seg );
                        // Polygon intersection point
View Full Code Here

Examples of bnGUI.venn.geometry.DragLabel

   * @param text
   */
  private void makeLabel(String text) {
    if( text != null )
    {                   
        DragLabel label = new DragLabel(transformer,text,currentNode.path );                
        if( popupPosition != null )
        {
            label.setLocation(popupPosition.x,popupPosition.y);
        }
        else
        {
            FPoint   p = null,
                center = null,
                dir = null;
               
            if( currentNode.vennObject != null )
            {
              if (((VennPolygonObject)(currentNode.vennObject)).getPolygon() != null)
              {
                center = currentNode.vennObject.getOffset();
                dir = center.sub(new FPoint(0.5,0.5));
                dir = dir.multiply(1/(dir.distance(new FPoint(0,0))));
                double circleRadius = Math.sqrt(((VennPolygonObject)currentNode.vennObject).getPolygon().area()/3.14);
                dir = dir.multiply(circleRadius+.15);
                p = center.add(dir);
           
                //p = currentNode.vennObject.getOffset();
              }
              else return;
            }
            else
            {
                p = new FPoint(0.5,0.5);
            }
            label.setRelativePosition(p);
        }
       
        label.setVisible(true);
        label.addMouseListener(this);
        label.addMouseMotionListener(this);
        add(label);
        notifyHasLabelsChanged();
        invalidateView();
        repaint();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.