protected void confirmDraggingSelectedObjects(int x, int y) { for (Iterator it = renderer.getSelectedObjectPainters().iterator(); it.hasNext(); ) { WorldRenderer.ObjectPainter objPainter = (WorldRenderer.ObjectPainter) it.next(); int requestId = localWorld.requestMoveObject( objPainter.originalObject, renderer.getDragPosition(objPainter, x, y), this); lockedObjects.add(objPainter.originalObject); lockedObjectInfo.put( new Long(objPainter.originalObject.getId()), new LockedObjectInfo(objPainter.originalObject, requestId)); renderer.endDragging(objPainter); } }
/** * Constructor for WorldMapWidget. * * @param parent - parent composite * @param mgr - the LocalWorld that should be shown. */ public WorldMapWidget(Composite parent, LocalWorld mgr, EditSession editSession) { super(parent, SWT.NO_BACKGROUND); localWorld = mgr; this.editSession = editSession; renderer = new WorldRenderer(mgr, editSession, this); selectCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_ARROW); createCursor = loadMouseCursor( "icons/createobjectcursor.png", "icons/createobjectcursor_mask.png", 10, 10, SWT.CURSOR_CROSS); zoomInCursor = loadMouseCursor( "icons/zoomincursor.png", "icons/zoomcursor_mask.png", 5, 5, SWT.CURSOR_ARROW); zoomOutCursor = loadMouseCursor( "icons/zoomoutcursor.png", "icons/zoomcursor_mask.png", 5, 5, SWT.CURSOR_ARROW); addPaintListener(this); addMouseMoveListener(this); addMouseListener(this); dragPoint = new Point(0, 0); doubleBuffering = true; setSize(1500, 1500); renderer.setScale(defaultScale, defaultScale); onGlobalsChanged(); localWorld.registerView(this); editSession.registerView(this); }