Package org.locationtech.udig.tools.edit.support

Examples of org.locationtech.udig.tools.edit.support.Point


        if (command == null) {
            ILayer selectedLayer = handler.getEditLayer();
            EditBlackboard editBlackboard = handler.getEditBlackboard(selectedLayer);
           
            Coordinate destinationCoord=null;
            Point dest;
            destinationCoord = calculateDestinationPoint(editBlackboard, destinationCoord);
   
            dest=editBlackboard.toPoint(destinationCoord);
            int deltaX = dest.getX() - lastPoint.getX();
            int deltaY = dest.getY()
                    - lastPoint.getY();
            if( deltaX!=0 || deltaY!=0 ){
                editBlackboard.moveSelection(deltaX, deltaY, toMove);
            }
            editBlackboard.setCoords(dest, destinationCoord);
   
            deltaX = dest.getX() - start.getX();
            deltaY = dest.getY() - start.getY();
   
           
            command=new MoveSelectionCommand(editBlackboard, deltaX, deltaY, toMove );
            command.setMap(getMap());
View Full Code Here


    private Coordinate calculateDestinationPoint( EditBlackboard editBlackboard, Coordinate destinationCoord ) {
        if( doSnap  ){
            destinationCoord = EditUtils.instance.getClosestSnapPoint(handler, editBlackboard, lastPoint, false,
                    snapBehaviour, stateAfterSnap);
        }
        Point dest;
        if (destinationCoord == null) {
            dest=editBlackboard.overVertex(lastPoint, PreferenceUtil.instance().getVertexRadius(), true);
            if( dest==null )
                dest=lastPoint;
            destinationCoord = editBlackboard.toCoord(dest);
View Full Code Here

    Unit<?> mapUnits = GeoToolsUtils.getDefaultCRSUnit(crs);

    parallelContext.setUnits(mapUnits);

    EditBlackboard bb = handler.getEditBlackboard(handler.getEditLayer());
    Point currPoint = Point.valueOf(event.x, event.y);
    Coordinate coor = bb.toCoord(currPoint);

    // previous line exist, if we change the reference line also need to
    // reset the initial point.
    // needs to store the line before setting the initial point.
View Full Code Here

        PrimitiveShape shell = handler.getCurrentShape();
       
        assert shell==shell.getEditGeom().getShell();
       
        Point newPoint = Point.valueOf(event.x, event.y);
        int lastPointIndex = shell.getNumPoints()-1;
        if( shell.getNumPoints()>2 && EditUtils.instance.intersection(shell.getPoint(lastPointIndex), newPoint, shell, 0, lastPointIndex) ){
            return Messages.ValidHoleValidator_selfIntersection;
        }
        return null;
View Full Code Here

        assert hole!=shell;
       
        // check the new edge (that will be created by event) to see if it intersect with the
        // rest of the hole
       
        Point newPoint = Point.valueOf(event.x, event.y);
        int lastPointIndex = hole.getNumPoints()-1;
        if( hole.getNumPoints()>2 && EditUtils.instance.intersection(hole.getPoint(lastPointIndex), newPoint, hole, 0, lastPointIndex) ){
            return Messages.ValidHoleValidator_selfIntersection;
        }
        if( !shell.contains(newPoint, true) )
View Full Code Here

    }
   
    @Test
    public void testSelect1FeatureThenAnother() throws Exception{
       
        Point p=handler.getEditBlackboard().toPoint(new Coordinate(0,10));
        tool.mouseReleased(new MapMouseEvent(handler.getContext().getMapDisplay(), p.getX(), p.getY(), 0,0,MapMouseEvent.BUTTON1));
       
        assertEquals("feature0", handler.getContext().getEditManager().getEditFeature().getAttribute("name"))//$NON-NLS-1$//$NON-NLS-2$

        p=handler.getEditBlackboard().toPoint(new Coordinate(10,15));
        tool.mouseReleased(new MapMouseEvent(handler.getContext().getMapDisplay(), p.getX(), p.getY(), 0,0,MapMouseEvent.BUTTON1));
       
        assertEquals("feature1", handler.getContext().getEditManager().getEditFeature().getAttribute("name")); //$NON-NLS-1$ //$NON-NLS-2$

        p=handler.getEditBlackboard().toPoint(new Coordinate(30,30));
        tool.mouseReleased(new MapMouseEvent(handler.getContext().getMapDisplay(), p.getX(), p.getY(), 0,0,MapMouseEvent.BUTTON1));
       
        assertEquals("feature2", handler.getContext().getEditManager().getEditFeature().getAttribute("name")); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

            return getCancelCommand(handler);
        }
        final int numPoints = currentShape.getNumPoints();
        assert numPoints == 1 || numPoints == 2;

        Point point1 = currentShape.getPoint(0);
        Shape shape = null;
        if (numPoints == 1) {
            linearArc.setLine(point1.getX(), point1.getY(), e.x, e.y);
            shape = linearArc;
        } else {
            Point point2 = currentShape.getPoint(1);
            double x1 = point1.getX();
            double y1 = point1.getY();
            double x2 = point2.getX();
            double y2 = point2.getY();
            double x3 = e.x;
            double y3 = e.y;

            arcBuilder.setPoints(x1, y1, x2, y2, x3, y3);
            shape = arcBuilder.getArc();
View Full Code Here

    if (!isValid(handler, e, eventType)) {
      throw new IllegalArgumentException("Behaviour is not valid for the current state"); //$NON-NLS-1$
    }
    EditBlackboard bb = handler.getEditBlackboard(handler.getEditLayer());
    Point currPoint = Point.valueOf(e.x, e.y);
    Coordinate coor = bb.toCoord(currPoint);

    SetInitialPointCommand setInitialPointCommand = new SetInitialPointCommand(this.parallelContext, coor);
    return setInitialPointCommand;
  }
View Full Code Here

    public UndoableMapCommand getCommand( EditToolHandler handler, MapMouseEvent e, EventType eventType ) {
        List<UndoableMapCommand> commands=new ArrayList<UndoableMapCommand>();
       
        if( handler.getCurrentState()==EditState.CREATING && addPoint){
            Point clickPoint = Point.valueOf(e.x, e.y);
            EditBlackboard editBlackboard = handler.getEditBlackboard(handler.getEditLayer());
           
            Point destination = editBlackboard.overVertex(clickPoint, PreferenceUtil.instance().getVertexRadius());
            if( destination==null ){
               
                AddVertexCommand addVertexCommand = new AddVertexCommand(handler, editBlackboard, clickPoint);

                try {
View Full Code Here

        if( !legalState || !legalEventType || !shapeAndGeomNotNull || !button1Released
        || e.buttonsDown() || e.modifiersDown() )
            return false;
       
        PrimitiveShape currentShape = handler.getCurrentShape();
        Point point=currentShape.getEditBlackboard().overVertex(Point.valueOf(e.x, e.y),
                PreferenceUtil.instance().getVertexRadius());
        if( currentShape.getPoint(0).equals(point) || currentShape.getPoint(currentShape.getNumPoints()-1).equals(point))
            return true;
       
        return false;
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.support.Point

Copyright © 2018 www.massapicom. 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.