Skip to content

Commit

Permalink
Avoid using deprecated methods
Browse files Browse the repository at this point in the history
Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Aug 22, 2023
1 parent 83f2582 commit 36b0efa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- enter the SVN commit message -->
<property name="commit.message" value="This should be the first commit, not sure yet"/>
<!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
<property name="plugin.main.version" value="14960"/>
<property name="plugin.main.version" value="18464"/>

<property name="plugin.author" value="Antochi Adrian and Trifan Adrian"/>
<property name="plugin.class" value="org.openstreetmap.josm.plugins.dxfimport.DxfImportPlugin"/>
Expand All @@ -15,6 +15,7 @@
<target name="additional-manifest">
<manifest file="MANIFEST" mode="update">
<attribute name="12671_Plugin-Url" value="1012;https://github.com/JOSM/Dxf-Import/releases/download/v1012/DxfImport.jar" />
<attribute name="14960_Plugin-Url" value="1014;https://github.com/JOSM/Dxf-Import/releases/download/v1014/DxfImport.jar" />
</manifest>
</target>
<!-- ** include targets that all plugins have in common ** -->
Expand Down
16 changes: 8 additions & 8 deletions src/org/openstreetmap/josm/plugins/dxfimport/DxfImportTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.openstreetmap.josm.command.SequenceCommand;
import org.openstreetmap.josm.data.UndoRedoHandler;
import org.openstreetmap.josm.data.coor.EastNorth;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.coor.ILatLon;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.Node;
import org.openstreetmap.josm.data.osm.Way;
Expand Down Expand Up @@ -53,7 +53,7 @@
public class DxfImportTask extends PleaseWaitRunnable {
LinkedList<Node> nodes = new LinkedList<>();
LinkedList<Way> ways = new LinkedList<>();
private File file;
private final File file;
private boolean canceled;

Projection projection = Projections.getProjectionByCode("EPSG:3857"); // Mercator
Expand Down Expand Up @@ -128,8 +128,8 @@ private void processElement(SVGElement el, AffineTransform transform) throws IOE
transform = new AffineTransform(transform);
transform.concatenate(xform);
}
for (Object child : ((Group) el).getChildren(null)) {
processElement((SVGElement) child, transform);
for (SVGElement child : el.getChildren(null)) {
processElement(child, transform);
}
transform = oldTransform;
} else if (el instanceof ShapeElement) {
Expand All @@ -150,7 +150,7 @@ private void processElement(SVGElement el, AffineTransform transform) throws IOE
appendNode(coords[0], coords[1]);
break;
case PathIterator.SEG_CLOSE:
if (currentway.firstNode().getCoor().equalsEpsilon(nodes.getLast().getCoor())) {
if (currentway.firstNode().equalsEpsilon(nodes.getLast())) {
currentway.removeNode(nodes.removeLast());
}
currentway.addNode(currentway.firstNode());
Expand Down Expand Up @@ -180,9 +180,9 @@ private void processElement(SVGElement el, AffineTransform transform) throws IOE

@Override
protected void realRun() throws IOException, OsmTransferException {
LatLon center = ProjectionRegistry.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter());
scale = Settings.getScaleNumerator() / Settings.getScaleDivisor() / Math.cos(Math.toRadians(center.lat()));
this.center = projection.latlon2eastNorth(center);
ILatLon currentCenter = ProjectionRegistry.getProjection().eastNorth2latlon(MainApplication.getMap().mapView.getCenter());
scale = Settings.getScaleNumerator() / Settings.getScaleDivisor() / Math.cos(Math.toRadians(currentCenter.lat()));
this.center = projection.latlon2eastNorth(currentCenter);
try {
SVGUniverse universe = new SVGUniverse();
universe.setVerbose(Config.getPref().getBoolean("importdxf.verbose", false));
Expand Down

0 comments on commit 36b0efa

Please sign in to comment.