Examples of MapMouseEvent


Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

    /*
     * Test method for 'org.locationtech.udig.tools.edit.behaviour.FreeHandPolygonDrawBehaviour.isValid(EditToolHandler, MapMouseEvent, EventType)'
     */
    @Test
    public void testIsValid() {
        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        assertTrue(behav.isValid(handler, event, EventType.DRAGGED));
        assertFalse(behav.isValid(handler, event, EventType.RELEASED));
        assertFalse(behav.isValid(handler, event, EventType.PRESSED));
        assertFalse(behav.isValid(handler, event, EventType.MOVED));
        assertFalse(behav.isValid(handler, event, EventType.WHEEL));
        assertTrue(behav.isValid(handler, event, EventType.DRAGGED));
        event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON2, MapMouseEvent.BUTTON1);
        assertFalse(behav.isValid(handler, event, EventType.DRAGGED));
    }
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

    @Ignore
    @Test
    public void testDrawLine() {
        handler.getMouseTracker().setDragStarted(Point.valueOf(0,10));
       
        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        assertTrue(handler.isLocked());
        assertNotNull(handler.getCurrentShape());
        assertEquals(EditState.CREATING, handler.getCurrentState());
       
        event=new MapMouseEvent(null, 20,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
        handler.handleEvent(event, EventType.RELEASED);
       
        assertFalse(handler.isLocked());
        assertEquals(Point.valueOf(0,10), handler.getCurrentShape().getPoint(0));
        assertEquals(Point.valueOf(10,10), handler.getCurrentShape().getPoint(1));
        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);

        assertEquals(currentShape, handler.getCurrentShape());
        assertEquals(Point.valueOf(0,10), handler.getCurrentShape().getPoint(0));
        assertEquals(Point.valueOf(10,10), handler.getCurrentShape().getPoint(1));
        assertEquals(Point.valueOf(20,10), handler.getCurrentShape().getPoint(2));
        assertEquals(Point.valueOf(30,10), handler.getCurrentShape().getPoint(3));
       
       
        //start a new line
        acceptor.ran=false;
        handler.getMouseTracker().setDragStarted(Point.valueOf(100,10));
        event=new MapMouseEvent(null, 100,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       
        handler.handleEvent(event, EventType.RELEASED);
       
        assertEquals(Point.valueOf(100,10), handler.getCurrentShape().getPoint(0));
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

    @Ignore
    @Test
    public void testDrawPolygon(){
        handler.getMouseTracker().setDragStarted(Point.valueOf(0,10));
       
        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       
        event=new MapMouseEvent(null, 20,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 20,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 10,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 1,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        handler.handleEvent(event, EventType.RELEASED);
   
        assertEquals(Point.valueOf(0,10), handler.getCurrentShape().getPoint(0));
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

        editBlackboard.addPoint(0,0,geom.getShell());
        handler.setCurrentShape(geom.getShell());
       
        handler.getMouseTracker().setDragStarted(Point.valueOf(10,10));
       
        MapMouseEvent event=new MapMouseEvent(null, 20,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);
       
        event=new MapMouseEvent(null, 20,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 10,20,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE,MapMouseEvent.BUTTON1, MapMouseEvent.BUTTON1);
        handler.handleEvent(event, EventType.DRAGGED);

        handler.handleEvent(event, EventType.RELEASED);
       
        assertEquals(geom, handler.getCurrentGeom());
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

    }
   
    @Test
    public void testStartingPolygon() throws Exception {

        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
        bb.addPoint(5, 5, shell);
       
        event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));       

        bb.addPoint(10, 10, shell);
       
        event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
    }
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

        bb.addPoint(20, 10, shell);
        bb.addPoint(20, 20, shell);
        bb.addPoint(10, 20, shell);
       
//      just closing hole should be legal
        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
//      no intersection so should be good
        event=new MapMouseEvent(null, 5,15,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
//      crosses 1st line so illegal
        event=new MapMouseEvent(null, 10, 5 ,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertEquals(Messages.ValidHoleValidator_selfIntersection, validator.isValid(handler, event, EventType.RELEASED));
    }
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

    }
   
    @Test
    public void testStartingHoles() throws Exception {

        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
        bb.addPoint(5, 5, hole);
       
        event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
    }
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

        bb.addPoint(20, 10, hole);
        bb.addPoint(20, 20, hole);
        bb.addPoint(10, 20, hole);
       
//      just closing hole should be legal
        MapMouseEvent event=new MapMouseEvent(null, 10,10,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
//      no intersection so should be good
        event=new MapMouseEvent(null, 5,15,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertNull(validator.isValid(handler, event, EventType.RELEASED));
       
//      crosses 1st line so illegal
        event=new MapMouseEvent(null, 10, 5 ,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertEquals(Messages.ValidHoleValidator_selfIntersection, validator.isValid(handler, event, EventType.RELEASED));
    }
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

        bb.addPoint(10, 10, hole);
        bb.addPoint(20, 10, hole);
        bb.addPoint(20, 20, hole);
        bb.addPoint(10, 20, hole);
        MapMouseEvent event=new MapMouseEvent(null, -5,20,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertEquals(Messages.ValidHoleValidator_outsideShell, validator.isValid(handler, event, EventType.RELEASED));
    }
View Full Code Here

Examples of org.locationtech.udig.project.ui.render.displayAdapter.MapMouseEvent

        bb.addPoint(70, 50, hole2);
        bb.addPoint(70, 70, hole2);
        bb.addPoint(50, 70, hole2);
        bb.addPoint(50, 50, hole2);
       
        MapMouseEvent event=new MapMouseEvent(null, 60, 60,MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertEquals(Messages.ValidHoleValidator_holeOverlap, validator.isValid(handler, event, EventType.RELEASED));
       
    }
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.