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

Examples of org.locationtech.udig.tools.edit.support.PrimitiveShape$PointCoordMap


    @Before
    public void setUp() throws Exception {
        handler = new TestHandler();
        moveGeometryBehaviour = new MoveGeometryBehaviour();
        handler.getBehaviours().add(moveGeometryBehaviour);
        PrimitiveShape shell = handler.getEditBlackboard().getGeoms().get(0).getShell();
        handler.getEditBlackboard().addPoint(0, 0, shell);
        handler.getEditBlackboard().addPoint(50, 0, shell);
        handler.getEditBlackboard().addPoint(50, 50, shell);
        handler.getEditBlackboard().addPoint(0, 50, shell);
        handler.getEditBlackboard().addPoint(0, 0, shell);
View Full Code Here


     */
    @Test
    public void testGetCommand() {

        EditGeom geom = handler.getCurrentGeom();
        PrimitiveShape hole = geom.newHole();
        EditBlackboard bb = handler.getEditBlackboard();

        bb.addPoint(5, 5, hole);
        bb.addPoint(25, 5, hole);
        bb.addPoint(25, 25, hole);
        bb.addPoint(5, 25, hole);
        bb.addPoint(5, 5, hole);

        handler.getMouseTracker().setDragStarted(Point.valueOf(10, 10));
        MapMouseEvent event = new MapMouseEvent(null, 20, 10, MapMouseEvent.ALT_DOWN_MASK
                | MapMouseEvent.CTRL_DOWN_MASK, MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        assertEquals(2, handler.getEditBlackboard().getCoords(10, 0).size());
        assertEquals(1, handler.getEditBlackboard().getCoords(60, 0).size());
        assertEquals(1, handler.getEditBlackboard().getCoords(60, 50).size());
        assertEquals(1, handler.getEditBlackboard().getCoords(10, 50).size());
        assertEquals(2, handler.getEditBlackboard().getCoords(15, 5).size());
        assertEquals(1, handler.getEditBlackboard().getCoords(35, 5).size());
        assertEquals(1, handler.getEditBlackboard().getCoords(35, 25).size());
        assertEquals(1, handler.getEditBlackboard().getCoords(15, 25).size());

        assertEquals(0, handler.getEditBlackboard().getCoords(0, 0).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(50, 0).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(50, 50).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(0, 50).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(5, 5).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(25, 5).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(25, 25).size());
        assertEquals(0, handler.getEditBlackboard().getCoords(5, 25).size());

        PrimitiveShape shell = handler.getCurrentShape();

        assertEquals(Point.valueOf(10, 0), shell.getPoint(0));
        assertEquals(Point.valueOf(60, 0), shell.getPoint(1));
        assertEquals(Point.valueOf(60, 50), shell.getPoint(2));
        assertEquals(Point.valueOf(10, 50), shell.getPoint(3));
        assertEquals(Point.valueOf(10, 0), shell.getPoint(4));
        assertEquals(Point.valueOf(15, 5), hole.getPoint(0));
        assertEquals(Point.valueOf(35, 5), hole.getPoint(1));
        assertEquals(Point.valueOf(35, 25), hole.getPoint(2));
        assertEquals(Point.valueOf(15, 25), hole.getPoint(3));
        assertEquals(Point.valueOf(15, 5), hole.getPoint(4));
View Full Code Here

        }
       
        System.out.println("Done first check"); //$NON-NLS-1$
       
        handler.getMouseTracker().setDragStarted(points[0]);
        PrimitiveShape shell = editBlackboard.getGeoms().get(0).getShell();
        handler.setCurrentShape(shell);

        Coordinate[] shellCoords=new Coordinate[coords.length];
       
        for( int i = 0; i < shellCoords.length; i++ ) {
            shellCoords[i]=shell.getCoord(i);
        }
       
        MapMouseEvent event = new MapMouseEvent(handler.getContext().getMapDisplay(), points[0]
                .getX(), points[0].getY(), MapMouseEvent.ALT_DOWN_MASK
                | MapMouseEvent.CTRL_DOWN_MASK, MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event = new MapMouseEvent(handler.getContext().getMapDisplay(), points[0]
                .getX() + 1, points[0].getY(), MapMouseEvent.ALT_DOWN_MASK
                | MapMouseEvent.CTRL_DOWN_MASK, MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       

        event = new MapMouseEvent(handler.getContext().getMapDisplay(), points[0]
                .getX() + 2, points[0].getY(), MapMouseEvent.ALT_DOWN_MASK
                | MapMouseEvent.CTRL_DOWN_MASK, MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        for( int i = 0; i < points.length; i++ ) {
            List<Coordinate> list = editBlackboard.getCoords(points[i].getX()+2, points[i].getY());
            System.out.println(list.size());
            assertTrue(!list.isEmpty());
        }

        for( int i = 0; i < points.length; i++ ) {
            List<EditGeom> list = editBlackboard.getGeoms(points[i].getX()+2, points[i].getY());
            System.out.println(list.size());
            assertTrue(!list.isEmpty());
        }
       
//        for( int i = 0; i < coords.length; i++ ) {
//            assertSame(  );
//        }
       
        Coordinate deltaPart1 = editBlackboard.toCoord(Point.valueOf(points[0].getX()+2, points[0].getY()));
        Coordinate deltaPart2 = editBlackboard.toCoord(points[0]);
        double deltaX = deltaPart1.x-deltaPart2.x;
        double deltaY = deltaPart1.y-deltaPart2.y;
       
        for( int i = 0; i < coords.length; i++ ) {
            assertEquals( new Coordinate( coords[i].x+deltaX, coords[i].y+deltaY ),
                    shell.getCoord(i) );
        }
       
       
    }
View Full Code Here

        handler.getEditBlackboard().addPoint(0,0, handler.getCurrentShape());
       
        // now we have something
        assertTrue(behavior.isValid(handler, event, EventType.RELEASED));
       
        PrimitiveShape hole = handler.getCurrentGeom().newHole();
        handler.getEditBlackboard().addPoint(30,30, hole);
        handler.getEditBlackboard().addPoint(60,30, hole);
        handler.getEditBlackboard().addPoint(60,60, hole);
        handler.getEditBlackboard().addPoint(30,60, hole);
        handler.getEditBlackboard().addPoint(30,30, hole);
View Full Code Here

   
    @Test
    public void testRunAndUndo() throws Exception {
        EditBlackboard map=new EditBlackboard(SCREEN.x, SCREEN.y, transform, layerToWorld);
       
        PrimitiveShape hole=map.getGeoms().get(0).newHole();
        InsertVertexCommand command1=new InsertVertexCommand(new TestHandler(), map, new TestViewportPane(new Dimension(500,500)), new EditUtils.StaticShapeProvider(hole), Point.valueOf(10,10), 0, true );
        InsertVertexCommand command2=new InsertVertexCommand(new TestHandler(), map, new TestViewportPane(new Dimension(500,500)), new EditUtils.StaticShapeProvider(hole), Point.valueOf(10,15), 0, true );

        assertEquals(0, map.getCoords(10,10).size());
        assertEquals(0, map.getCoords(10,15).size());
       
        command1.run(new NullProgressMonitor());
        command2.run(new NullProgressMonitor());
       
        assertEquals(1, map.getCoords(10,10).size());
        assertEquals(1, map.getCoords(10,15).size());
        assertEquals( Point.valueOf(10,15), hole.getPoint(0));
        assertEquals( Point.valueOf(10,10), hole.getPoint(1));
       
        command2.rollback(new NullProgressMonitor());
        assertTrue( 0==map.getCoords(10,15).size());
        assertTrue(0==map.getGeoms(10,15).size());
        assertEquals(Point.valueOf(10,10), hole.getPoint(0));
        assertEquals(1, hole.getNumPoints());
        assertEquals(1, hole.getNumCoords());
       
        command1.rollback(new NullProgressMonitor());
        assertTrue(0==map.getCoords(10,10).size());
        assertTrue(0==map.getGeoms(10,10).size());
        assertEquals(0, hole.getNumPoints());
        assertEquals(0, hole.getNumCoords());
       
       
    }
View Full Code Here

        SimpleFeature feature = resource.getFeatures().features().next();
        IEditManager editManager = handler.getContext().getEditManager();
    ((EditManager)editManager).setEditFeature(feature, (Layer) layer);
       
        EditBlackboard editBlackboard = handler.getEditBlackboard();
        PrimitiveShape shell = editBlackboard.getGeoms().get(0).getShell();
        editBlackboard.addPoint(100,100,shell);
        shell.getEditGeom().setShapeType(ShapeType.POINT);
        editBlackboard.newGeom("newone", null); //$NON-NLS-1$
       
        StartEditingBehaviour behav=new StartEditingBehaviour(ShapeType.POLYGON);

        handler.getBehaviours().add(behav);
View Full Code Here

     */
    @Test
    public void testDifferencePolygonOnce() throws Exception {
        handler.resetEditBlackboard();
        EditBlackboard bb = handler.getEditBlackboard();
        PrimitiveShape shell = bb.newGeom(null, null).getShell();
        handler.setCurrentShape(shell);
        bb.addPoint(25,0, shell);
        bb.addPoint(35,0, shell);
        bb.addPoint(35,60, shell);
        bb.addPoint(25,60, shell);
View Full Code Here

        GeometryFactory fac=new GeometryFactory();
        Polygon[] polygons = new Polygon[]{ (Polygon) features[1].getDefaultGeometry()};
        MultiPolygon createMultiPolygon = fac.createMultiPolygon(polygons);
        features[1].setDefaultGeometry(createMultiPolygon);
        EditBlackboard bb = handler.getEditBlackboard();
        PrimitiveShape shell = bb.newGeom(null, null).getShell();
        handler.setCurrentShape(shell);
        bb.addPoint(25,0, shell);
        bb.addPoint(35,0, shell);
        bb.addPoint(35,60, shell);
        bb.addPoint(25,60, shell);
View Full Code Here

    store.modifyFeatures(features[0].getFeatureType().getGeometryDescriptor(), polygon,
                filterFactory.id(FeatureUtils.stringToId(filterFactory, features[0].getID())));
   
        EditBlackboard bb = handler.getEditBlackboard();
       
        PrimitiveShape shell = bb.newGeom(null, null).getShell();
        handler.setCurrentShape(shell);
        bb.addPoint(25,0, shell);
        bb.addPoint(35,0, shell);
        bb.addPoint(35,60, shell);
        bb.addPoint(25,60, shell);
View Full Code Here

    store.removeFeatures(filterFactory.id(FeatureUtils.stringToId(filterFactory, features[1].getID())));
        store.modifyFeatures(features[0].getFeatureType().getGeometryDescriptor(), geom,
                filterFactory.id(FeatureUtils.stringToId(filterFactory, features[0].getID())));
        EditBlackboard bb = handler.getEditBlackboard();
       
        PrimitiveShape shell = bb.newGeom(null, null).getShell();
        handler.setCurrentShape(shell);
        bb.addPoint(25,0, shell);
        bb.addPoint(35,0, shell);
        bb.addPoint(35,65, shell);
        bb.addPoint(25,65, shell);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.tools.edit.support.PrimitiveShape$PointCoordMap

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.