update polyline marker plot functions

This commit is contained in:
wyq 2021-12-13 15:25:49 +08:00
parent 3970f0e7a0
commit dbdca0fef8
14 changed files with 68 additions and 56 deletions

View File

@ -449,7 +449,7 @@ public class ChartColorBar extends ChartLegend {
break;
case POLYLINE:
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(idx);
DrawShape = aPLB.getDrawPolyline();
DrawShape = aPLB.isDrawPolyline();
FillColor = aPLB.getColor();
break;
case POLYGON:
@ -775,7 +775,7 @@ public class ChartColorBar extends ChartLegend {
break;
case POLYLINE:
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(idx);
DrawShape = aPLB.getDrawPolyline();
DrawShape = aPLB.isDrawPolyline();
FillColor = aPLB.getColor();
break;
case POLYGON:

View File

@ -831,7 +831,7 @@ public class GraphicFactory {
gc.setSingleLegend(false);
PolylineBreak lb = (PolylineBreak) ecb.clone();
if (cb instanceof PolylineBreak)
lb.setDrawSymbol(((PolylineBreak)cb).getDrawSymbol());
lb.setDrawSymbol(((PolylineBreak)cb).isDrawSymbol());
else {
lb.setSymbol((PointBreak) cb);
lb.setCaption(cb.getCaption());
@ -1171,12 +1171,12 @@ public class GraphicFactory {
ps = new PointShape();
ps.setPoint(new PointD(xIter.getDoubleNext(), yIter.getDoubleNext()));
graphics.add(new Graphic(ps, cbs.get(0)));
LegendScheme ls = new LegendScheme();
ls.setLegendBreaks(cbs);
ls.setLegendType(LegendType.SINGLE_SYMBOL);
ls.setShapeType(ShapeTypes.POINT);
graphics.setLegendScheme(ls);
}
LegendScheme ls = new LegendScheme();
ls.setLegendBreaks(cbs);
ls.setLegendType(LegendType.SINGLE_SYMBOL);
ls.setShapeType(ShapeTypes.POINT);
graphics.setLegendScheme(ls);
}
return graphics;
}

View File

@ -2930,7 +2930,7 @@ public class Draw {
drawPolyline(points, g);
//Draw symbol
if (alb.getDrawSymbol()) {
if (alb.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Rectangle clip = g.getClipBounds();
@ -2942,7 +2942,7 @@ public class Draw {
if (p.X >= clip.x && p.X <= clip.x + clip.width && p.Y >= clip.y && p.Y <= clip.y + clip.height) {
if (i % alb.getSymbolInterval() == 0) {
drawPoint(alb.getSymbolStyle(), p, alb.getSymbolFillColor(), alb.getSymbolColor(),
alb.getSymbolSize(), true, alb.isFillSymbol(), g);
alb.getSymbolSize(), alb.isDrawSymbolOutline(), alb.isFillSymbol(), g);
}
}
}
@ -2952,7 +2952,7 @@ public class Draw {
if (i % alb.getSymbolInterval() == 0) {
p = new PointF(points[i].X, points[i].Y);
drawPoint(alb.getSymbolStyle(), p, alb.getSymbolFillColor(), alb.getSymbolColor(),
alb.getSymbolSize(), true, alb.isFillSymbol(), g);
alb.getSymbolSize(), alb.isDrawSymbolOutline(), alb.isFillSymbol(), g);
}
}
}
@ -3004,7 +3004,7 @@ public class Draw {
}
//Draw symbol
if (alb.getDrawSymbol()) {
if (alb.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Rectangle clip = g.getClipBounds();
@ -3016,7 +3016,7 @@ public class Draw {
if (p.X >= clip.x && p.X <= clip.x + clip.width && p.Y >= clip.y && p.Y <= clip.y + clip.height) {
if (i % alb.getSymbolInterval() == 0) {
drawPoint(alb.getSymbolStyle(), p, alb.getSymbolFillColor(), alb.getSymbolColor(),
alb.getSymbolSize(), true, alb.isFillSymbol(), g);
alb.getSymbolSize(), alb.isDrawSymbolOutline(), alb.isFillSymbol(), g);
}
}
}
@ -3026,7 +3026,7 @@ public class Draw {
if (i % alb.getSymbolInterval() == 0) {
p = new PointF(points[i].X, points[i].Y);
drawPoint(alb.getSymbolStyle(), p, alb.getSymbolFillColor(), alb.getSymbolColor(),
alb.getSymbolSize(), true, alb.isFillSymbol(), g);
alb.getSymbolSize(), alb.isDrawSymbolOutline(), alb.isFillSymbol(), g);
}
}
}
@ -3054,7 +3054,7 @@ public class Draw {
drawPolyline(points, g);
//Draw symbol
if (aPLB.getDrawSymbol()) {
if (aPLB.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Rectangle clip = g.getClipBounds();
@ -3066,7 +3066,7 @@ public class Draw {
if (p.X >= clip.x && p.X <= clip.x + clip.width && p.Y >= clip.y && p.Y <= clip.y + clip.height) {
if (i % aPLB.getSymbolInterval() == 0) {
drawPoint(aPLB.getSymbolStyle(), p, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(),
aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
}
}
@ -3076,7 +3076,7 @@ public class Draw {
if (i % aPLB.getSymbolInterval() == 0) {
p = new PointF(points[i].X, points[i].Y);
drawPoint(aPLB.getSymbolStyle(), p, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(),
aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
}
}
@ -3249,12 +3249,12 @@ public class Draw {
path.reset();
path.moveTo(p.X, p.Y);
//Draw symbol
if (aPLB.getDrawSymbol()) {
if (aPLB.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
for (int j = 0; j < drawPs.size(); j++) {
Draw.drawPoint(aPLB.getSymbolStyle(), p, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(),
aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, rend);
}
@ -3283,7 +3283,7 @@ public class Draw {
}
//Draw symbol
if (aPLB.getDrawSymbol()) {
if (aPLB.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
@ -3299,7 +3299,7 @@ public class Draw {
}
if (i % aPLB.getSymbolInterval() == 0) {
drawPoint(aPLB.getSymbolStyle(), p, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(),
aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
}
}
@ -3313,7 +3313,7 @@ public class Draw {
if (i % aPLB.getSymbolInterval() == 0) {
p = new PointF(points[i].X, points[i].Y);
drawPoint(aPLB.getSymbolStyle(), p, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(),
aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
}
}
@ -3464,15 +3464,15 @@ public class Draw {
float[] dashPattern = getDashPattern(aPLB.getStyle());
g.setStroke(new BasicStroke(aPLB.getWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dashPattern, 0.0f));
if (aPLB.getDrawPolyline()) {
if (aPLB.isDrawPolyline()) {
drawPolyline(points, g);
}
g.setStroke(new BasicStroke());
//Draw symbol
if (aPLB.getDrawSymbol()) {
drawPoint(aPLB.getSymbolStyle(), points[1], aPLB.getSymbolFillColor(), aPLB.getSymbolColor(), aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
drawPoint(aPLB.getSymbolStyle(), points[2], aPLB.getSymbolFillColor(), aPLB.getSymbolColor(), aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
if (aPLB.isDrawSymbol()) {
drawPoint(aPLB.getSymbolStyle(), points[1], aPLB.getSymbolFillColor(), aPLB.getSymbolColor(), aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
drawPoint(aPLB.getSymbolStyle(), points[2], aPLB.getSymbolFillColor(), aPLB.getSymbolColor(), aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
} else {
PointF[] points = new PointF[2];
@ -3614,14 +3614,14 @@ public class Draw {
float[] dashPattern = getDashPattern(aPLB.getStyle());
g.setStroke(new BasicStroke(aPLB.getWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dashPattern, 0.0f));
if (aPLB.getDrawPolyline()) {
if (aPLB.isDrawPolyline()) {
drawPolyline(points, g);
}
g.setStroke(new BasicStroke());
//Draw symbol
if (aPLB.getDrawSymbol()) {
drawPoint(aPLB.getSymbolStyle(), aP, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(), aPLB.getSymbolSize(), true, aPLB.isFillSymbol(), g);
if (aPLB.isDrawSymbol()) {
drawPoint(aPLB.getSymbolStyle(), aP, aPLB.getSymbolFillColor(), aPLB.getSymbolColor(), aPLB.getSymbolSize(), aPLB.isDrawSymbolOutline(), aPLB.isFillSymbol(), g);
}
} else {
PointF[] points = new PointF[2];

View File

@ -729,7 +729,7 @@ public class LayoutLegend extends LayoutElement {
case POLYLINE:
case POLYLINE_Z:
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(idx);
DrawShape = aPLB.getDrawPolyline();
DrawShape = aPLB.isDrawPolyline();
FillColor = aPLB.getColor();
if (aLS.getLegendType() == LegendType.UNIQUE_VALUE) {
caption = aPLB.getCaption();
@ -923,7 +923,7 @@ public class LayoutLegend extends LayoutElement {
case POLYLINE:
case POLYLINE_Z:
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(idx);
DrawShape = aPLB.getDrawPolyline();
DrawShape = aPLB.isDrawPolyline();
FillColor = aPLB.getColor();
break;
case POLYGON:
@ -1117,7 +1117,7 @@ public class LayoutLegend extends LayoutElement {
case POLYLINE:
case POLYLINE_Z:
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(i);
DrawShape = aPLB.getDrawPolyline();
DrawShape = aPLB.isDrawPolyline();
FillColor = aPLB.getColor();
if (aLS.getLegendType() == LegendType.UNIQUE_VALUE) {
caption = aPLB.getCaption();
@ -1288,7 +1288,7 @@ public class LayoutLegend extends LayoutElement {
case POLYLINE:
case POLYLINE_Z:
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(i);
DrawShape = aPLB.getDrawPolyline();
DrawShape = aPLB.isDrawPolyline();
FillColor = aPLB.getColor();
break;
case POLYGON:

View File

@ -513,7 +513,7 @@ import javax.swing.JColorChooser;
this.jLabel_Color.setBackground(_polylineBreak.getColor());
this.jSpinner_Size.setValue(_polylineBreak.getWidth());
this.jCheckBox_DrawShape.setSelected(_polylineBreak.isDrawShape());
this.jCheckBox_DrawPointSymbol.setSelected(_polylineBreak.getDrawSymbol());
this.jCheckBox_DrawPointSymbol.setSelected(_polylineBreak.isDrawSymbol());
this.jSpinner_SymbolSize.setValue(_polylineBreak.getSymbolSize());
this.jLabel_SymbolColor.setBackground(_polylineBreak.getSymbolColor());
this.jSpinner_SymbolInterval.setValue(_polylineBreak.getSymbolInterval());

View File

@ -5057,7 +5057,7 @@ public class MapView extends JPanel implements IWebMapPanel {
continue;
}
if (aPLB.getDrawPolyline()) {
if (aPLB.isDrawPolyline()) {
drawLonLatPolylineShape(g, aPLS, aPLB, LonShift);
}
}
@ -5405,7 +5405,7 @@ public class MapView extends JPanel implements IWebMapPanel {
}
PolylineBreak aPLB = (PolylineBreak) aLS.getLegendBreaks().get(aPLS.getLegendIndex());
if (aPLB.getDrawPolyline() || aPLB.getDrawSymbol()) {
if (aPLB.isDrawPolyline() || aPLB.isDrawSymbol()) {
drawPolylineShape(g, aPLS, aPLB, LonShift, isStreamline);
}
}
@ -5473,7 +5473,7 @@ public class MapView extends JPanel implements IWebMapPanel {
g.setStroke(pen);
List<PointF> drawPs = new ArrayList<>();
if (aPLB.getDrawPolyline()) {
if (aPLB.isDrawPolyline()) {
for (Polyline aline : aPLS.getPolylines()) {
double[] sXY;
PointF[] Points = new PointF[aline.getPointList().size()];
@ -5525,7 +5525,7 @@ public class MapView extends JPanel implements IWebMapPanel {
}
//Draw symbol
if (aPLB.getDrawSymbol()) {
if (aPLB.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
for (int i = 0; i < drawPs.size(); i++) {
@ -5590,7 +5590,7 @@ public class MapView extends JPanel implements IWebMapPanel {
path.reset();
path.moveTo(sXY[0], sXY[1]);
//Draw symbol
if (aPLB.getDrawSymbol()) {
if (aPLB.isDrawSymbol()) {
Object rend = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
for (int j = 0; j < drawPs.size(); j++) {

View File

@ -447,7 +447,7 @@ package org.meteoinfo.geometry.graphic;
//legendType.InnerText = "PolylineBreak";
size.setValue(String.valueOf(aPLB.getWidth()));
style.setValue(aPLB.getStyle().toString());
drawSymbol.setValue(String.valueOf(aPLB.getDrawSymbol()));
drawSymbol.setValue(String.valueOf(aPLB.isDrawSymbol()));
symbolSize.setValue(String.valueOf(aPLB.getSymbolSize()));
symbolStyle.setValue(String.valueOf(aPLB.getSymbolStyle()));
symbolColor.setValue(ColorUtil.toHexEncoding(aPLB.getSymbolColor()));

View File

@ -959,7 +959,7 @@ package org.meteoinfo.geometry.legend;
drawShape.setValue(String.valueOf(aPLB.isDrawShape()));
size.setValue(String.valueOf(aPLB.getWidth()));
style.setValue(aPLB.getStyle().toString());
drawSymbol.setValue(String.valueOf(aPLB.getDrawSymbol()));
drawSymbol.setValue(String.valueOf(aPLB.isDrawSymbol()));
symbolSize.setValue(String.valueOf(aPLB.getSymbolSize()));
symbolStyle.setValue(aPLB.getSymbolStyle().toString());
symbolColor.setValue(ColorUtil.toHexEncoding(aPLB.getSymbolColor()));

View File

@ -137,7 +137,7 @@ public class PolylineBreak extends ColorBreak {
*
* @return Boolean
*/
public boolean getDrawPolyline() {
public boolean isDrawPolyline() {
return drawPolyline;
}
@ -155,7 +155,7 @@ public class PolylineBreak extends ColorBreak {
*
* @return Boolean
*/
public boolean getDrawSymbol() {
public boolean isDrawSymbol() {
return drawSymbol;
}
@ -168,6 +168,14 @@ public class PolylineBreak extends ColorBreak {
drawSymbol = isTrue;
}
/**
* Get is draw symbol outline or not
* @return Draw symbol outline or not
*/
public boolean isDrawSymbolOutline() {
return this.symbolColor != null;
}
/**
* Get symbol size
*

View File

@ -1,12 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<MeteoInfo File="milconfig.xml" Type="configurefile">
<Path OpenPath="D:\Working\MIScript\Jython\mis\test">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map\projection"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\io\grib"/>
<Path OpenPath="D:\Working\MIScript\Jython\mis\plot_types\plot">
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\3d"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\map"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\grads"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\contour"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\netcdf"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\meteo"/>
@ -16,17 +13,22 @@
<RecentFolder Folder="D:\Working\MIScript\Jython\mis"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\test\turtle"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\test"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\scatter"/>
<RecentFolder Folder="D:\Working\MIScript\Jython\mis\plot_types\plot"/>
</Path>
<File>
<OpenedFiles>
<OpenedFile File="D:\Working\MIScript\Jython\mis\toolbox\miml\deep_learning\classification\saturn.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf_elev_texturemap.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\io\wrfout_chem_1.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_marker.py"/>
<OpenedFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_marker_1.py"/>
</OpenedFiles>
<RecentFiles>
<RecentFile File="D:\Working\MIScript\Jython\mis\toolbox\miml\deep_learning\classification\saturn.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\3d\jogl\surf_elev_texturemap.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\io\wrfout_chem_1.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_marker.py"/>
<RecentFile File="D:\Working\MIScript\Jython\mis\plot_types\plot\plot_marker_1.py"/>
</RecentFiles>
</File>
<Font>

View File

@ -1348,8 +1348,6 @@ class Axes(object):
s = kwargs.pop('s', 8)
c = kwargs.pop('c', None)
if c is None:
c = kwargs.pop('facecolor', 'b')
#Add data series
label = kwargs.pop('label', 'S_0')
@ -1358,6 +1356,10 @@ class Axes(object):
#Set plot data styles
pb, isunique = plotutil.getlegendbreak('point', **kwargs)
if c is None:
c = pb.getColor()
if c is None:
c = 'b'
pb.setCaption(label)
#pstyle = plotutil.getpointstyle(marker)
#pb.setStyle(pstyle)

View File

@ -388,6 +388,7 @@ def getplotstyle(style, caption, **kwargs):
markerfillcolor = kwargs.pop('markerfacecolor', markercolor)
markerfillcolor = getcolor(markerfillcolor)
plb.setSymbolFillColor(markerfillcolor)
plb.setFillSymbol(not markerfillcolor is None)
return plb
else:
plb = PolylineBreak()
@ -473,11 +474,10 @@ def getlegendbreak(geometry, **kwargs):
markersize = kwargs.pop('markersize', None)
if not markersize is None:
lb.setSymbolSize(markersize)
markercolor = kwargs.pop('markercolor', None)
if not markercolor is None:
markercolor = getcolor(markercolor)
lb.setSymbolColor(markercolor)
fillcolor = kwargs.pop('makerfillcolor', None)
markercolor = kwargs.pop('markeredgecolor', None)
markercolor = getcolor(markercolor)
lb.setSymbolColor(markercolor)
fillcolor = kwargs.pop('markerfacecolor', None)
if not fillcolor is None:
lb.setFillSymbol(True)
lb.setSymbolFillColor(getcolor(fillcolor))