Changeset 33350 in osm for applications
- Timestamp:
- 2017-05-31T16:43:56+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/public_transport_layer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/public_transport_layer/build.xml
r32817 r33350 3 3 4 4 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 5 <property name="plugin.main.version" value="1 0808"/>5 <property name="plugin.main.version" value="11722"/> 6 6 7 7 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/public_transport_layer/src/ptl/PublicTransportLayer.java
r32817 r33350 6 6 import java.awt.BasicStroke; 7 7 import java.awt.Color; 8 import java.awt.Font;9 8 import java.awt.Graphics2D; 10 9 import java.awt.event.ActionEvent; … … 28 27 import org.openstreetmap.josm.gui.MapView; 29 28 import org.openstreetmap.josm.gui.layer.Layer; 30 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy; 29 import org.openstreetmap.josm.gui.mappaint.Cascade; 30 import org.openstreetmap.josm.gui.mappaint.Environment; 31 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 32 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 31 33 import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel; 32 34 import org.openstreetmap.josm.tools.ColorHelper; … … 51 53 } 52 54 final StyledMapRenderer renderer = new StyledMapRenderer(g, mv, false); 55 renderer.getSettings(false); 53 56 54 57 final Collection<Relation> selectedRelations = mv.getLayerManager().getEditLayer().data.getSelectedRelations(); … … 87 90 88 91 protected void drawRefLabels(StyledMapRenderer renderer, MultiMap<Pair<Node, Node>, String> segmentRefs) { 92 Environment env = new Environment(); 93 env.mc = new MultiCascade(); 94 Cascade c = env.mc.getOrCreateCascade("default"); 95 c.put(StyleKeys.FONT_FAMILY, "SansSerif"); 96 c.put(StyleKeys.FONT_SIZE, 16); 97 Color color = new Color(0x80FFFFFF, true); 98 89 99 for (Pair<Node, Node> nodePair : segmentRefs.keySet()) { 90 100 final String label = Utils.join(tr(", "), new TreeSet<>(segmentRefs.get(nodePair))); 91 final TextLabel text = new TextLabel(new LabelCompositionStrategy.StaticLabelCompositionStrategy(label),92 new Font("SansSerif", Font.PLAIN, 16), 0, 0, new Color(0x80FFFFFF, true), 0f, null);101 c.put(StyleKeys.TEXT, label); 102 final TextLabel text = TextLabel.create(env, color, false); 93 103 final Way way = new Way(); 94 104 way.addNode(nodePair.a); 95 105 way.addNode(nodePair.b); 96 renderer.drawText OnPath(way, text);106 renderer.drawText(way, text); 97 107 } 98 108 }
Note:
See TracChangeset
for help on using the changeset viewer.