mirror of
https://github.com/meteoinfo/MeteoInfo.git
synced 2025-12-08 20:36:05 +00:00
add xShift function for GraphicCollection
This commit is contained in:
parent
11e2dd5bbb
commit
85a3e6cdac
@ -5,6 +5,9 @@
|
||||
*/
|
||||
package org.meteoinfo.chart.plot3d;
|
||||
|
||||
import org.meteoinfo.common.Extent3D;
|
||||
import org.meteoinfo.common.PointD;
|
||||
import org.meteoinfo.geometry.graphic.Graphic;
|
||||
import org.meteoinfo.geometry.graphic.GraphicCollection;
|
||||
|
||||
import java.util.List;
|
||||
@ -178,4 +181,20 @@ public class GraphicCollection3D extends GraphicCollection{
|
||||
public void setUsingLight(boolean value) {
|
||||
this.usingLight = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* X coordinate shift
|
||||
* @param xs X shift value
|
||||
*/
|
||||
public GraphicCollection xShift(double xs) {
|
||||
for (Graphic g : this.graphics) {
|
||||
for (PointD p : g.getShape().getPoints()) {
|
||||
p.X += xs;
|
||||
}
|
||||
g.setExtent(((Extent3D) g.getExtent()).shift(xs, 0, 0));
|
||||
}
|
||||
this._extent.shift(xs, 0);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
*/
|
||||
package org.meteoinfo.geometry.graphic;
|
||||
|
||||
import org.meteoinfo.common.Extent3D;
|
||||
import org.meteoinfo.geometry.legend.*;
|
||||
import org.meteoinfo.common.Extent;
|
||||
import org.meteoinfo.common.MIMath;
|
||||
@ -33,8 +34,8 @@ import java.util.NoSuchElementException;
|
||||
public class GraphicCollection extends Graphic implements Iterator {
|
||||
|
||||
// <editor-fold desc="Variables">
|
||||
private List<Graphic> graphics = new ArrayList<>();
|
||||
private Extent _extent = new Extent();
|
||||
protected List<Graphic> graphics = new ArrayList<>();
|
||||
protected Extent _extent = new Extent();
|
||||
protected boolean singleLegend = true;
|
||||
private int index;
|
||||
private LabelSet labelSet;
|
||||
@ -682,5 +683,21 @@ public class GraphicCollection extends Graphic implements Iterator {
|
||||
|
||||
return cgraphics;
|
||||
}
|
||||
|
||||
/**
|
||||
* X coordinate shift
|
||||
* @param xs X shift value
|
||||
*/
|
||||
public GraphicCollection xShift(double xs) {
|
||||
for (Graphic g : this.graphics) {
|
||||
for (PointD p : g.getShape().getPoints()) {
|
||||
p.X += xs;
|
||||
}
|
||||
g.setExtent(g.getExtent().shift(xs, 0));
|
||||
}
|
||||
this._extent.shift(xs, 0);
|
||||
|
||||
return this;
|
||||
}
|
||||
// </editor-fold>
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user