Is there a way to create a style for symbolising a point from Java Graphics?
I have a class that return Java graphics, but couldn't figure how to create
style from it
public Graphic crtaj(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Double s = new Double((double) ((float) this._x - 10.0F *
this._f),
(double) ((float) this._y - 10.0F * this._f),
(double) (20.0F *
this._f), (double) (20.0F * this._f));
crtajPodlogu(g2, s);
g2.draw(new Double((double) ((float) this._x - 5.0F * this._f),
(double)
((float) this._y - 5.0F * this._f),
(double) (10.0F * this._f), (double) (10.0F *
this._f)));
g2.draw(new Double((double) this._x - 0.5D, (double) this._y -
0.5D, 1.0D,
1.0D));
g2.draw(new Float((float) this._x, (float) this._y - 10.0F *
this._f,
(float) this._x,
(float) this._y - 20.0F * this._f));
g2.draw(new Float((float) this._x - 10.0F * this._f, (float)
this._y -
15.0F * this._f,
(float) this._x + 10.0F * this._f, (float)
this._y - 15.0F * this._f));
g2.draw(new Float((float) this._x - 10.0F * this._f, (float)
this._y -
20.0F * this._f,
(float) this._x + 10.0F * this._f, (float)
this._y - 20.0F * this._f));
g2.draw(new Float((float) this._x + 10.0F * this._f, (float)
this._y -
20.0F * this._f, (float) this._x,
(float) this._y - 40.0F * this._f));
g2.draw(new Float((float) this._x, (float) this._y - 40.0F *
this._f,
(float) this._x - 10.0F * this._f,
(float) this._y - 20.0F * this._f));
g2.draw(new java.awt.geom.Rectangle2D.Double((double) ((float)
this._x -
2.0F * this._f),
(double) ((float) this._y - 30.0F * this._f),
(double) (4.0F * this._f),
(double) (8.0F * this._f)));
return (Graphic) g;
}
another and third class
public void paintComponent(Graphics g) {
Class e = Class.forName("topkljuc." +
this.nazivKlase);
try {
TackaZnak e2 = (TackaZnak)
e.newInstance();
e2._x = (long) (this.getWidth()
/ 2);
e2._y = (long)
(this.getHeight() / 2);
this.postaviBoju(g);
e2.crtaj(g);
this.vratiStaruBoju(g);
} catch (Exception arg20) {
g.drawString(arg20 + " " +
e.getName(), 20, 20);
}
}
public Graphic crtaj(Graphics g) {
g.setColor(this.getForeground());
return (Graphic) g;
}
I posted only part of code in my classes
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Java-Graphics-to-create-a-style-tp5309648.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users