Skip to content

Commit

Permalink
Rename MapData to more descriptive MapPixelData
Browse files Browse the repository at this point in the history
  • Loading branch information
mmyers committed Jun 3, 2024
1 parent 6526836 commit 6bddac3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion EU3_Scenario_Editor/src/editor/MapPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void initialize(Map map, FilenameResolver resolver, ProvinceData provData

log.log(Level.INFO, "Reading map from image...");
long startTime = System.currentTimeMillis();
final MapData data = new MapData(scaledMapImage, map.getMaxProvinces());
final MapPixelData data = new MapPixelData(scaledMapImage, map.getMaxProvinces());
log.log(Level.INFO, "Done in {0} ms.", System.currentTimeMillis() - startTime);
model = new MapPanelDataModel(data, map, provData);
model.setDate("1453.1.1");
Expand Down
8 changes: 4 additions & 4 deletions EU3_Scenario_Editor/src/editor/MapPanelDataModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class MapPanelDataModel implements java.io.Serializable {

private final ProvinceData provinceData;

private final MapData mapData;
private final MapPixelData mapData;

private final Map map;

Expand All @@ -39,15 +39,15 @@ public class MapPanelDataModel implements java.io.Serializable {

private String date;

public MapPanelDataModel(MapData data, Map map, ProvinceData pData) {
public MapPanelDataModel(MapPixelData data, Map map, ProvinceData pData) {
//this(data, null, pData);
this.mapData = data;
this.map = map;
this.provinceData = pData;
this.dataSource = null;
}

// private MapPanelDataModel(MapData data, ClausewitzDataSource source, ProvinceData provinceData) {
// private MapPanelDataModel(MapPixelData data, ClausewitzDataSource source, ProvinceData provinceData) {
// this.provinceData = provinceData;
// mapData = data;
// dataSource = source;
Expand All @@ -58,7 +58,7 @@ public ProvinceData getProvinceData() {
return provinceData;
}

public MapData getMapData() {
public MapPixelData getMapData() {
return mapData;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MapData.java
* MapPixelData.java
*
* Moved out of MapPanel.java in 0.4pre1
*/
Expand All @@ -13,7 +13,7 @@


/** @since 0.3pre1 */
public final class MapData {
public final class MapPixelData {

/**
* Mapping of rgb value to a list of horizontal lines in the province.
Expand All @@ -31,10 +31,9 @@ public final class MapData {

private static final int BLACK = 0xFF000000; // java.awt.Color.BLACK.getRGB();

public MapData(final BufferedImage img, final int numProvs) {
provLines = new HashMap<Integer, List<Integer[]>>(numProvs);
final java.util.Map<Integer[], Object> tmpBorders =
new HashMap<Integer[], Object>(numProvs*32);
public MapPixelData(final BufferedImage img, final int numProvs) {
provLines = new HashMap<>(numProvs);
java.util.Map<Integer[], Object> tmpBorders = new HashMap<>(numProvs*32);

int rgb;

Expand All @@ -48,7 +47,7 @@ public MapData(final BufferedImage img, final int numProvs) {
rgb = rgbLine[x];

if (provLines.get(rgb) == null)
provLines.put(rgb, new ArrayList<Integer[]>(100));
provLines.put(rgb, new ArrayList<>(100));

Integer[] points = new Integer[3];

Expand Down Expand Up @@ -88,7 +87,7 @@ public MapData(final BufferedImage img, final int numProvs) {
}
}

borders = new ArrayList<Integer[]>(tmpBorders.keySet());
borders = new ArrayList<>(tmpBorders.keySet());
}

public List<Integer[]> getLinesInProv(int rgb) {
Expand Down

0 comments on commit 6bddac3

Please sign in to comment.