public void pick(DrawContext dc, java.awt.Point pickPoint) { OGLStackHandler stackHandler = new OGLStackHandler(); BasicAnnotationRenderer.this.pickSupport.clearPickList(); BasicAnnotationRenderer.this.beginDrawAnnotations(dc, stackHandler); try { this.annotation.setPickSupport(BasicAnnotationRenderer.this.pickSupport); this.doRender(dc, this); // Draw as many as we can in a batch to save ogl state switching. while (dc.peekOrderedRenderables() is OrderedAnnotation) { OrderedAnnotation oa = (OrderedAnnotation)dc.pollOrderedRenderables(); oa.annotation.setPickSupport(BasicAnnotationRenderer.this.pickSupport); this.doRender(dc, oa); } } catch (WWRuntimeException e) { Logging.logger().log(Level.SEVERE, "generic.ExceptionWhilePickingAnnotation", e); } catch (Exception e) { Logging.logger().log(Level.SEVERE, "generic.ExceptionWhilePickingAnnotation", e); } finally { BasicAnnotationRenderer.this.endDrawAnnotations(dc, stackHandler); BasicAnnotationRenderer.this.pickSupport.resolvePick(dc, pickPoint, this.layer); BasicAnnotationRenderer.this.pickSupport.clearPickList(); // to ensure entries can be garbage collected } }
public static void alignComponent(Component parent, Component child, String alignment) { Dimension prefSize = child.getPreferredSize(); java.awt.Point parentLocation = parent != null?parent.getLocation() : new java.awt.Point(0, 0); Dimension parentSize = parent != null?parent.getSize() : Toolkit.getDefaultToolkit().getScreenSize(); int x = parentLocation.x; int y = parentLocation.y; if (alignment != null && alignment.Equals(AVKey.RIGHT)) { x += parentSize.width - 50; y += parentSize.height - prefSize.height; } else if (alignment != null && alignment.Equals(AVKey.CENTER)) { x += (parentSize.width - prefSize.width) / 2; y += (parentSize.height - prefSize.height) / 2; } else if (alignment != null && alignment.Equals(AVKey.LEFT_OF_CENTER)) { x += parentSize.width / 2 - 1.05 * prefSize.width; y += (parentSize.height - prefSize.height) / 2; } else if (alignment != null && alignment.Equals(AVKey.RIGHT_OF_CENTER)) { x += parentSize.width / 2 + 0.05 * prefSize.width; y += (parentSize.height - prefSize.height) / 2; } // else it's left aligned by default child.setLocation(x, y); }
protected void doPick(DrawContext dc, java.awt.Point point) { // any state that could change the color needs to be disabled, such as GL_TEXTURE, GL_LIGHTING or GL_FOG. // re-draw with unique colors // store the object info in the selectable objects table // read the color under the cursor // use the color code as a key to retrieve a selected object from the selectable objects table // create an instance of the PickedObject and add to the dc via the dc.addPickedObject() method }
/** * Detects the locations of the sector geometries in this list that intersect a specified screen point. * <p/> * Note: Prior to calling this method, {@link #beginRendering(gov.nasa.worldwind.render.DrawContext)} must be * called. * * @param dc the current draw context. * @param pickPoint the screen point to test. */ public void pick(DrawContext dc, java.awt.Point pickPoint) { if (dc == null) { String message = Logging.getMessage("nullValue.DrawContextIsNull"); Logging.logger().severe(message); throw new IllegalStateException(message); } if (pickPoint == null) { return; } this.pickSupport.clearPickList(); this.pickSupport.beginPicking(dc); GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility. gl.glShadeModel(GL2.GL_FLAT); try { // render each sector in unique color this.beginRendering(dc); foreach (SectorGeometry sector in this) { Color color = dc.getUniquePickColor(); gl.glColor3ub((byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()); sector.render(dc); // lat/lon/elevation not used in this case this.pickSupport.addPickableObject(color.getRGB(), sector, Position.ZERO, true); } PickedObject pickedSector = this.pickSupport.getTopObject(dc, pickPoint); if (pickedSector == null || pickedSector.getObject() == null) { return; // no sector picked } this.beginSectorGeometryPicking(dc); SectorGeometry sector = (SectorGeometry)pickedSector.getObject(); sector.pick(dc, pickPoint); } finally { this.endSectorGeometryPicking(dc); this.endRendering(dc); gl.glShadeModel(GL2.GL_SMOOTH); // restore to default explicitly to avoid more expensive pushAttrib this.pickSupport.endPicking(dc); this.pickSupport.clearPickList(); } }
public void pick(DrawContext dc, java.awt.Point point) { if (!this.enabled) { return; // Don't check for arg errors if we're disabled } if (null == dc) { string message = Logging.getMessage("nullValue.DrawContextIsNull"); Logging.logger().severe(message); throw new IllegalStateException(message); } if (null == dc.getGlobe()) { string message = Logging.getMessage("layers.AbstractLayer.NoGlobeSpecifiedInDrawingContext"); Logging.logger().severe(message); throw new IllegalStateException(message); } if (null == dc.getView()) { string message = Logging.getMessage("layers.AbstractLayer.NoViewSpecifiedInDrawingContext"); Logging.logger().severe(message); throw new IllegalStateException(message); } if (!this.isLayerActive(dc)) { return; } if (!this.isLayerInView(dc)) { return; } this.doPick(dc, point); }
/// <summary> /// Gets the component that contains the specified point. /// </summary> public Component getComponentAt(Point @p) { return default(Component); }
/// <summary> /// Constructs a WritableRaster with the given SampleModel. /// </summary> public WritableRaster(SampleModel @sampleModel, Point @origin) : base(sampleModel, origin) { }
/// <summary> /// Convert a <code>aPoint</code> in <code>source</code> coordinate system to /// <code>destination</code> coordinate system. /// </summary> public Point convertPoint(Component @source, Point @aPoint, Component @destination) { return default(Point); }
/// <summary> /// Converts a point in pixel coordinates to view coordinates. /// </summary> public Point toViewCoordinates(Point @p) { return default(Point); }
/// <summary> /// Constructs a WritableRaster with the given SampleModel and DataBuffer. /// </summary> public WritableRaster(SampleModel @sampleModel, DataBuffer @dataBuffer, Point @origin) : base(sampleModel, origin) { }
/// <summary> /// Moves this component to a new location. /// </summary> public void setLocation(Point @p) { }
/// <summary> /// Stores the x,y origin of this component into "return value" <b>rv</b> /// and return <b>rv</b>. /// </summary> public Point getLocation(Point @rv) { return default(Point); }
/// <summary> /// Creates a WritableRaster with the specified SampleModel. /// </summary> public WritableRaster createWritableRaster(SampleModel @sm, Point @location) { return default(WritableRaster); }
/// <summary> /// Constructs a Raster with the given SampleModel, DataBuffer, and /// parent. /// </summary> public Raster(SampleModel @sampleModel, DataBuffer @dataBuffer, Rectangle @aRegion, Point @sampleModelTranslate, Raster @parent) { }
/// <summary> /// Creates a Raster based on a SinglePixelPackedSampleModel with /// the specified data type, width, height, and band masks. /// </summary> public WritableRaster createPackedRaster(int @dataType, int @w, int @h, int[] @bandMasks, Point @location) { return default(WritableRaster); }
/// <summary> /// Creates a Raster with the specified SampleModel and DataBuffer. /// </summary> public Raster createRaster(SampleModel @sm, DataBuffer @db, Point @location) { return default(Raster); }
/// <summary> /// Creates a Raster based on a MultiPixelPackedSampleModel with the /// specified DataBuffer, width, height, and bits per pixel. /// </summary> public WritableRaster createPackedRaster(DataBuffer @dataBuffer, int @w, int @h, int @bitsPerPixel, Point @location) { return default(WritableRaster); }
/// <summary> /// Constructs a Raster with the given SampleModel and DataBuffer. /// </summary> public Raster(SampleModel @sampleModel, DataBuffer @dataBuffer, Point @origin) { }
/// <summary> /// Creates a Raster based on a SinglePixelPackedSampleModel with /// the specified DataBuffer, width, height, scanline stride, and /// band masks. /// </summary> public WritableRaster createPackedRaster(DataBuffer @dataBuffer, int @w, int @h, int @scanlineStride, int[] @bandMasks, Point @location) { return default(WritableRaster); }
/// <summary> /// Creates a Raster based on a PixelInterleavedSampleModel with the /// specified data type, width, height, scanline stride, pixel /// stride, and band offsets. /// </summary> public WritableRaster createInterleavedRaster(int @dataType, int @w, int @h, int @scanlineStride, int @pixelStride, int[] @bandOffsets, Point @location) { return default(WritableRaster); }
/// <summary> /// Constructs a Raster with the given SampleModel. /// </summary> public Raster(SampleModel @sampleModel, Point @origin) { }
/// <summary> /// Constructs and initializes a point with the same location as /// the specified <code>Point</code> object. /// </summary> public Point(Point @p) { }
/// <summary> /// Creates a Raster based on a BandedSampleModel with the /// specified data type, width, height, scanline stride, bank /// indices and band offsets. /// </summary> public WritableRaster createBandedRaster(int @dataType, int @w, int @h, int @scanlineStride, int[] @bankIndices, int[] @bandOffsets, Point @location) { return default(WritableRaster); }
/// <summary> /// Checks whether this component "contains" the specified point, /// where the point's <i>x</i> and <i>y</i> coordinates are defined /// to be relative to the coordinate system of this component. /// </summary> public bool contains(Point @p) { return default(bool); }
/// <summary> /// Creates a Raster based on a BandedSampleModel with the /// specified data type, width, height, and number of bands. /// </summary> public WritableRaster createBandedRaster(int @dataType, int @w, int @h, int @bands, Point @location) { return default(WritableRaster); }
/// <summary> /// Sets the view coordinates that appear in the upper left /// hand corner of the viewport, does nothing if there's no view. /// </summary> public void setViewPosition(Point @p) { }
public virtual void addLocation(Point p) { ((Writer) this.writer).write(new StringBuilder().append("\t\t<location x=\"").append((int) p.x).append("\" y=\"").append((int) p.y).append("\"/>\n").toString()); }
/// <summary> /// Computes the parameters for a blit where the backing store image /// currently contains <code>oldLoc</code> in the upper left hand corner /// and we're scrolling to <code>newLoc</code>. /// </summary> protected bool computeBlit(int @dx, int @dy, Point @blitFrom, Point @blitTo, Dimension @blitSize, Rectangle @blitPaint) { return default(bool); }
public void pick(DrawContext dc, Annotation annotation, Vec4 annotationPoint, java.awt.Point pickPoint, Layer layer) { if (!isAnnotationValid(annotation, false)) { return; } this.drawOne(dc, annotation, annotationPoint, layer); }
/// <summary> /// Constructs a WritableRaster with the given SampleModel, DataBuffer, /// and parent. /// </summary> public WritableRaster(SampleModel @sampleModel, DataBuffer @dataBuffer, Rectangle @aRegion, Point @sampleModelTranslate, WritableRaster @parent) : base(sampleModel, null) { }
/// <summary> /// Construct a <code>DropTargetDragEvent</code> given the /// <code>DropTargetContext</code> for this operation, /// the location of the "Drag" <code>Cursor</code>'s hotspot /// in the <code>Component</code>'s coordinates, the /// user drop action, and the source drop actions. /// </summary> public DropTargetDragEvent(DropTargetContext @dtc, Point @cursorLocn, int @dropAction, int @srcActions) : base(null) { }
/// <summary> /// Returns the <code>Accessible</code> child contained at the /// local coordinate <code>Point</code>, if one exists. /// </summary> public Accessible getAccessibleAt(Component @c, Point @p) { return default(Accessible); }
/// <summary> /// Returns the component in the currently selected path /// which contains sourcePoint. /// </summary> public Component componentForPoint(Component @source, Point @sourcePoint) { return default(Component); }
/// <summary> /// Convert a point from a screen coordinates to a component's /// coordinate system /// </summary> static public void convertPointFromScreen(Point @p, Component @c) { }
public void pick(DrawContext dc, java.awt.Point pickPoint) { // TODO }
/// <summary> /// Converts the given place in the view coordinate system /// to the nearest representative location in the model. /// </summary> public int viewToModel(Point @pt) { return default(int); }
/// <summary> /// Construct a <code>DropTargetEvent</code> given the /// <code>DropTargetContext</code> for this operation, /// the location of the drag <code>Cursor</code>'s hotspot /// in the <code>Component</code>'s /// coordinates, the currently selected user drop action, /// the current set of actions supported by the source, /// and a <code>boolean</code> indicating if the source is in the same JVM /// as the target. /// </summary> public DropTargetDropEvent(DropTargetContext @dtc, Point @cursorLocn, int @dropAction, int @srcActions, bool @isLocal): base(null) { }