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

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


    @Test
    public void testRun() throws Exception {
        TestHandler handler=new TestHandler();
       
        EditBlackboard editBlackboard = handler.getEditBlackboard();
        PrimitiveShape shape = editBlackboard.getGeoms().get(0).getShell();
        editBlackboard.addPoint(0,0, shape);
        editBlackboard.addPoint(100,0, shape);
        editBlackboard.addPoint(100,100, shape);
        editBlackboard.addPoint(0,100, shape);
        editBlackboard.addPoint(0,0, shape);
       
        PrimitiveShape hole = shape.getEditGeom().newHole();
        editBlackboard.addPoint(5,5, hole);
        editBlackboard.addPoint(20,5, hole);
        editBlackboard.addPoint(20,20, hole);
        editBlackboard.addPoint(5,20, hole);
        editBlackboard.addPoint(5,5, hole);
       
        PrimitiveShape hole2 = shape.getEditGeom().newHole();
        editBlackboard.addPoint(30,30, hole2);
        editBlackboard.addPoint(80,30, hole2);
        editBlackboard.addPoint(80,80, hole2);
        editBlackboard.addPoint(30,80, hole2);
        editBlackboard.addPoint(30,30, hole2);
View Full Code Here


        assertEquals(Point.valueOf(20,10), handler.getCurrentShape().getPoint(2));
        assertEquals(ShapeType.LINE, handler.getCurrentGeom().getShapeType());
        assertFalse( acceptor.ran);

        //continue line
        PrimitiveShape currentShape = handler.getCurrentShape();
       
        handler.getMouseTracker().setDragStarted(Point.valueOf(20,11));
        event=new MapMouseEvent(null, 30,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
        handler.handleEvent(event, EventType.RELEASED);
View Full Code Here

    public void testInOtherHole() throws Exception {

        bb.addPoint(10, 10, hole);
        bb.addPoint(20, 10, hole);
       
        PrimitiveShape hole2 = geom.newHole();
       
        bb.addPoint(50, 50, hole2);
        bb.addPoint(70, 50, hole2);
        bb.addPoint(70, 70, hole2);
        bb.addPoint(50, 70, hole2);
View Full Code Here

        FeatureSource<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureSource.class, null);
        SimpleFeature feature = resource.getFeatures().features().next();
        ((EditManager)handler.getContext().getEditManager()).setEditFeature(feature, (Layer) layer);
       
        final 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$
       
        CreateShapeBehaviour behav=new CreateShapeBehaviour(new ShapeFactory(){
            @Override
            public GeneralPath create( int width, int height ) {
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();
        AddVertexCommand command1=new AddVertexCommand(new TestHandler(), map, new StaticBlockingProvider<PrimitiveShape>(hole), Point.valueOf(10,10), true );
        AddVertexCommand command2=new AddVertexCommand(new TestHandler(), map, new StaticBlockingProvider<PrimitiveShape>(hole), Point.valueOf(10,15), 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());
       
        command2.rollback(new NullProgressMonitor());
        assertTrue(map.getCoords(10,15)==null || 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(map.getCoords(10,10)==null || 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

    }

    @Test
    public void testLine() throws Exception {
        EditGeom line = bb.newGeom("line", ShapeType.LINE); //$NON-NLS-1$
        PrimitiveShape shell = line.getShell();
       
        bb.addPoint(10, 10, shell);
        bb.addPoint(20, 20, shell);
        bb.addPoint(20, 30, shell);
        bb.addPoint(5, 20, shell);
View Full Code Here

    }
   
    @Test
    public void testPoint() throws Exception {
        EditGeom point = bb.newGeom("line", ShapeType.POINT); //$NON-NLS-1$
        PrimitiveShape shell = point.getShell();
       
        bb.addPoint(10, 10, shell);
       
        assertNull(validator.isValid(handler, null, null));
    }
View Full Code Here

    }
   
    @Test
    public void testPolygonLegal() throws Exception {
        EditGeom polygon = bb.newGeom("line", ShapeType.POLYGON); //$NON-NLS-1$
        PrimitiveShape shell = polygon.getShell();
       
        bb.addPoint(10, 10, shell);
        bb.addPoint(20, 10, shell);
        bb.addPoint(20, 20, shell);
        bb.addPoint(10, 20, shell);
        bb.addPoint(10, 10, shell);
       
       
        PrimitiveShape hole = polygon.newHole();
        bb.addPoint(12, 12, hole);
        bb.addPoint(15, 12, hole);
        bb.addPoint(15, 15, hole);
        bb.addPoint(12, 12, hole);
       
        PrimitiveShape hole2 = polygon.newHole();
        bb.addPoint(15, 12, hole2);
        bb.addPoint(19, 19, hole2);
        bb.addPoint(15, 19, hole2);
        bb.addPoint(15, 12, hole2);
       
View Full Code Here

    }
   
    @Test
    public void testShellSelfIntersection() throws Exception {
        EditGeom polygon = bb.newGeom("line", ShapeType.POLYGON); //$NON-NLS-1$
        PrimitiveShape shell = polygon.getShell();
       
        bb.addPoint(10, 10, shell);
        bb.addPoint(20, 10, shell);
        bb.addPoint(20, 20, shell);
        bb.addPoint(10, 20, shell);
View Full Code Here

    }

    @Test
    public void testHoleSelfIntersection() throws Exception {
        EditGeom polygon = bb.newGeom("line", ShapeType.POLYGON); //$NON-NLS-1$
        PrimitiveShape shell = polygon.getShell();
       
        bb.addPoint(10, 10, shell);
        bb.addPoint(20, 10, shell);
        bb.addPoint(20, 20, shell);
        bb.addPoint(10, 20, shell);
        bb.addPoint(10, 10, shell);
       
        PrimitiveShape hole = polygon.newHole();
        bb.addPoint(12, 12, hole);
        bb.addPoint(18, 12, hole);
        bb.addPoint(18, 18, hole);
        bb.addPoint(16, 11, hole);
       
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.