📄 abstractrenderer.java
字号:
* Returns the item label position for negative values in ALL series. * * @return the item label position (possibly <code>null</code>). */ public ItemLabelPosition getNegativeItemLabelPosition() { return this.negativeItemLabelPosition; } /** * Sets the item label position for negative values in ALL series, and sends a * {@link RendererChangeEvent} to all registered listeners. You need to set this to * <code>null</code> to expose the settings for individual series. * * @param position the position (<code>null</code> permitted). */ public void setNegativeItemLabelPosition(ItemLabelPosition position) { setNegativeItemLabelPosition(position, true); } /** * Sets the item label position for negative values in ALL series and (if requested) sends * a {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> permitted). * @param notify notify registered listeners? */ public void setNegativeItemLabelPosition(ItemLabelPosition position, boolean notify) { this.negativeItemLabelPosition = position; if (notify) { notifyListeners(new RendererChangeEvent(this)); } } /** * Returns the item label position for all negative values in a series. * * @param series the series index (zero-based). * * @return The item label position (never <code>null</code>). */ public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) { // return the override, if there is one... if (this.negativeItemLabelPosition != null) { return this.negativeItemLabelPosition; } // otherwise look up the position list ItemLabelPosition position = (ItemLabelPosition) this.negativeItemLabelPositionList.get(series); if (position == null) { position = this.baseNegativeItemLabelPosition; } return position; } /** * Sets the item label position for negative values in a series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero-based). * @param position the position (<code>null</code> permitted). */ public void setSeriesNegativeItemLabelPosition(int series, ItemLabelPosition position) { setSeriesNegativeItemLabelPosition(series, position, true); } /** * Sets the item label position for negative values in a series and (if requested) sends a. * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero-based). * @param position the position (<code>null</code> permitted). * @param notify notify registered listeners? */ public void setSeriesNegativeItemLabelPosition(int series, ItemLabelPosition position, boolean notify) { this.negativeItemLabelPositionList.set(series, position); if (notify) { notifyListeners(new RendererChangeEvent(this)); } } /** * Returns the base item label position for negative values. * * @return The position (never <code>null</code>). */ public ItemLabelPosition getBaseNegativeItemLabelPosition() { return this.baseNegativeItemLabelPosition; } /** * Sets the base item label position for negative values and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). */ public void setBaseNegativeItemLabelPosition(ItemLabelPosition position) { setBaseNegativeItemLabelPosition(position, true); } /** * Sets the base negative item label position and, if requested, sends a * {@link RendererChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). * @param notify notify registered listeners? */ public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, boolean notify) { if (position == null) { throw new IllegalArgumentException("Null 'position' argument."); } this.baseNegativeItemLabelPosition = position; if (notify) { notifyListeners(new RendererChangeEvent(this)); } } /** * Returns the item label anchor offset. * * @return the offset. */ public double getItemLabelAnchorOffset() { return this.itemLabelAnchorOffset; } /** * Sets the item label anchor offset. * * @param offset the offset. */ public void setItemLabelAnchorOffset(double offset) { this.itemLabelAnchorOffset = offset; notifyListeners(new RendererChangeEvent(this)); } /** The adjacent offset. */ private static final double ADJ = Math.cos(Math.PI / 6.0); /** The opposite offset. */ private static final double OPP = Math.sin(Math.PI / 6.0); /** * Calculates the item label anchor point. * * @param anchor the anchor. * @param x the x coordinate. * @param y the y coordinate. * @param orientation the plot orientation. * * @return the anchor point (never <code>null</code>). */ protected Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor, double x, double y, PlotOrientation orientation) { Point2D result = null; if (anchor == ItemLabelAnchor.CENTER) { result = new Point2D.Double(x, y); } else if (anchor == ItemLabelAnchor.INSIDE1) { result = new Point2D.Double( x + OPP * this.itemLabelAnchorOffset, y - ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE2) { result = new Point2D.Double( x + ADJ * this.itemLabelAnchorOffset, y - OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE3) { result = new Point2D.Double(x + this.itemLabelAnchorOffset, y); } else if (anchor == ItemLabelAnchor.INSIDE4) { result = new Point2D.Double( x + ADJ * this.itemLabelAnchorOffset, y + OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE5) { result = new Point2D.Double( x + OPP * this.itemLabelAnchorOffset, y + ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE6) { result = new Point2D.Double(x, y + this.itemLabelAnchorOffset); } else if (anchor == ItemLabelAnchor.INSIDE7) { result = new Point2D.Double( x - OPP * this.itemLabelAnchorOffset, y + ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE8) { result = new Point2D.Double( x - ADJ * this.itemLabelAnchorOffset, y + OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE9) { result = new Point2D.Double(x - this.itemLabelAnchorOffset, y); } else if (anchor == ItemLabelAnchor.INSIDE10) { result = new Point2D.Double( x - ADJ * this.itemLabelAnchorOffset, y - OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE11) { result = new Point2D.Double( x - OPP * this.itemLabelAnchorOffset, y - ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.INSIDE12) { result = new Point2D.Double(x, y - this.itemLabelAnchorOffset); } else if (anchor == ItemLabelAnchor.OUTSIDE1) { result = new Point2D.Double( x + 2.0 * OPP * this.itemLabelAnchorOffset, y - 2.0 * ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE2) { result = new Point2D.Double( x + 2.0 * ADJ * this.itemLabelAnchorOffset, y - 2.0 * OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE3) { result = new Point2D.Double(x + 2.0 * this.itemLabelAnchorOffset, y); } else if (anchor == ItemLabelAnchor.OUTSIDE4) { result = new Point2D.Double( x + 2.0 * ADJ * this.itemLabelAnchorOffset, y + 2.0 * OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE5) { result = new Point2D.Double( x + 2.0 * OPP * this.itemLabelAnchorOffset, y + 2.0 * ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE6) { result = new Point2D.Double(x, y + 2.0 * this.itemLabelAnchorOffset); } else if (anchor == ItemLabelAnchor.OUTSIDE7) { result = new Point2D.Double( x - 2.0 * OPP * this.itemLabelAnchorOffset, y + 2.0 * ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE8) { result = new Point2D.Double( x - 2.0 * ADJ * this.itemLabelAnchorOffset, y + 2.0 * OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE9) { result = new Point2D.Double(x - 2.0 * this.itemLabelAnchorOffset, y); } else if (anchor == ItemLabelAnchor.OUTSIDE10) { result = new Point2D.Double( x - 2.0 * ADJ * this.itemLabelAnchorOffset, y - 2.0 * OPP * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE11) { result = new Point2D.Double( x - 2.0 * OPP * this.itemLabelAnchorOffset, y - 2.0 * ADJ * this.itemLabelAnchorOffset ); } else if (anchor == ItemLabelAnchor.OUTSIDE12) { result = new Point2D.Double(x, y - 2.0 * this.itemLabelAnchorOffset); } return result; } /** * Registers an object to receive notification of changes to the renderer. * * @param listener the listener (<code>null</code> not permitted). */ public void addChangeListener(RendererChangeListener listener) { if (listener == null) { throw new IllegalArgumentException("Null 'listener' argument."); } this.listenerList.add(RendererChangeListener.class, listener); } /** * Deregisters an object so that it no longer receives notification of changes to the renderer. * * @param listener the object (<code>null</code> not permitted). */ public void removeChangeListener(RendererChangeListener listener) { if (listener == null) { throw new IllegalArgumentException("Null 'listener' argument."); } this.listenerList.remove(RendererChangeListener.class, listener); } /** * Notifies all registered listeners that the renderer has been modified. * * @param event information about the change event. */ public void notifyListeners(RendererChangeEvent event) { Object[] ls = this.listenerList.getListenerList(); for (int i = ls.length - 2; i >= 0; i -= 2) { if (ls[i] == RendererChangeListener.class) { ((RendererChangeListener) ls[i + 1]).rendererChanged(event); } } } /** * Tests this renderer for equality with another object. * * @param obj the object. * * @return <code>true</code> or <code>false</code>. */ public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj instanceof AbstractRenderer) { AbstractRenderer renderer = (AbstractRenderer) obj; boolean b0 = ObjectUtils.equal(this.paint, renderer.paint); boolean b1 = ObjectUtils.equal(this.paintList, renderer.paintList); boolean b2 = ObjectUtils.equal(this.basePaint, renderer.basePaint); boolean b3 = ObjectUtils.equal(this.outlinePaint, renderer.outlinePaint); boolean b4 = ObjectUtils.equal(this.outlinePaintList, renderer.outlinePaintList); boolean b5 = ObjectUtils.equal(this.baseOutlinePaint, renderer.baseOutlinePaint); boolean b6 = ObjectUtils.equal(this.stroke, renderer.stroke); boolean b7 = ObjectUtils.equal(this.strokeList, renderer.strokeList); boolean b8 = ObjectUtils.equal(this.baseStroke, renderer.baseStroke); boolean b9 = ObjectUtils.equal(this.outlineStroke, renderer.outlineStroke); boolean b10 = ObjectUtils.equal(this.outlineStrokeList, renderer.outlineStrokeList); boolean b11 = ObjectUtils.equal(this.baseOutlineStroke, renderer.baseOutlineStroke); boolean b12 = ObjectUtils.equal(this.shape, renderer.shape); boolean b13 = ObjectUtils.equal(this.shapeList, renderer.shapeList); boolean b14 = ObjectUtils.equal(this.baseShape, renderer.baseShape); boolean b15 = ObjectUtils.equal(this.itemLabelsVisible, renderer.itemLabelsVisible); boolean b16 = ObjectUtils.equal(this.itemLabelsVisibleList, renderer.itemLabelsVisibleList); boolean b17 = ObjectUtils.equal(this.baseItemLabelsVisible, renderer.baseItemLabelsVisible); boolean b18 = ObjectUtils.equal(this.itemLabelFont, renderer.itemLabelFont); boolean b19 = ObjectUtils.equal(this.itemLabelFontList, renderer.itemLabelFontList); boolean b20 = ObjectUtils.equal(this.baseItemLabelFont, renderer.baseItemLabelFont); boolean b21 = ObjectUtils.equal(this.itemLabelPaint, renderer.itemLabelPaint); boolean b22 = ObjectUtils.equal(this.itemLabelPaintList, renderer.itemLabelPaintList); boolean b23 = ObjectUtils.equal(this.baseItemLabelPaint, renderer.baseItemLabelPaint); boolean b24 = ObjectUtils.equal(this.positiveItemLabelPosition, renderer.positiveItemLabelPosition); boolean b25 = ObjectUtils.equal(this.positiveItemLabelPositionList,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -