Skip to content

Commit 580e040

Browse files
author
pdavidc
committed
Corrected SurfaceText handling of cached extent. Fixes and closes #28.
1 parent b81455c commit 580e040

File tree

5 files changed

+23
-34
lines changed

5 files changed

+23
-34
lines changed

src/gov/nasa/worldwind/render/AbstractSurfaceObject.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ protected void clearCaches()
299299
this.extentCache.clear();
300300
}
301301

302+
/* Updates this SurfaceObject's modified time and clears its internal caches. */
303+
protected void onShapeChanged()
304+
{
305+
this.updateModifiedTime();
306+
this.clearCaches();
307+
}
308+
302309
//**************************************************************//
303310
//******************** Extent ********************************//
304311
//**************************************************************//

src/gov/nasa/worldwind/render/AbstractSurfaceShape.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,12 +603,6 @@ public void combine(CombineContext cc)
603603
protected abstract void doMoveTo(Position oldReferencePosition, Position newReferencePosition);
604604
protected abstract void doMoveTo(Globe globe, Position oldReferencePosition, Position newReferencePosition);
605605

606-
protected void onShapeChanged()
607-
{
608-
this.updateModifiedTime();
609-
this.clearCaches();
610-
}
611-
612606
/**
613607
* {@inheritDoc}
614608
* <p/>

src/gov/nasa/worldwind/render/SurfaceIcon.java

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void setLocation(LatLon location)
8181
}
8282

8383
this.location = location;
84-
this.onPropertyChanged();
84+
this.onShapeChanged();
8585
}
8686

8787
/**
@@ -112,7 +112,7 @@ public Vec4 getLocationOffset()
112112
public void setLocationOffset(Vec4 locationOffset)
113113
{
114114
this.locationOffset = locationOffset; // can be null
115-
this.onPropertyChanged();
115+
this.onShapeChanged();
116116
}
117117

118118
/**
@@ -145,7 +145,7 @@ public void setImageSource(Object imageSource)
145145

146146
this.imageSource = imageSource;
147147
this.texture = null;
148-
this.onPropertyChanged();
148+
this.onShapeChanged();
149149
}
150150

151151
/**
@@ -172,7 +172,7 @@ public void setUseMipMaps(boolean useMipMaps)
172172
{
173173
this.useMipMaps = useMipMaps;
174174
this.texture = null;
175-
this.onPropertyChanged();
175+
this.onShapeChanged();
176176
}
177177

178178
/**
@@ -202,7 +202,7 @@ public void setScale(double scale)
202202
throw new IllegalArgumentException(message);
203203
}
204204
this.scale = scale;
205-
this.onPropertyChanged();
205+
this.onShapeChanged();
206206
}
207207

208208
/**
@@ -224,7 +224,7 @@ public Angle getHeading()
224224
public void setHeading(Angle heading)
225225
{
226226
this.heading = heading; // can be null
227-
this.onPropertyChanged();
227+
this.onShapeChanged();
228228
}
229229

230230
/**
@@ -281,7 +281,7 @@ public double getMinSize()
281281
public void setMinSize(double sizeInMeter)
282282
{
283283
this.minSize = sizeInMeter;
284-
this.onPropertyChanged();
284+
this.onShapeChanged();
285285
}
286286

287287
/**
@@ -312,7 +312,7 @@ public double getMaxSize()
312312
public void setMaxSize(double sizeInMeter)
313313
{
314314
this.maxSize = sizeInMeter;
315-
this.onPropertyChanged();
315+
this.onShapeChanged();
316316
}
317317

318318
/**
@@ -344,7 +344,7 @@ public void setColor(Color color)
344344
throw new IllegalArgumentException(message);
345345
}
346346
this.color = color;
347-
this.onPropertyChanged();
347+
this.onShapeChanged();
348348
}
349349

350350
protected boolean isMaintainAppearance()
@@ -436,18 +436,6 @@ public void drawGeographic(DrawContext dc, SurfaceTileDrawContext sdc)
436436
}
437437
}
438438

439-
protected void onPropertyChanged()
440-
{
441-
this.updateModifiedTime();
442-
this.clearCaches();
443-
}
444-
445-
@Override
446-
protected void clearCaches()
447-
{
448-
super.clearCaches();
449-
}
450-
451439
protected List<Sector> computeSectors(DrawContext dc)
452440
{
453441
if (this.location == null)

src/gov/nasa/worldwind/render/SurfaceIcons.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Iterable<? extends LatLon> getLocations()
3737
public void setLocations(Iterable<? extends LatLon> newLocations)
3838
{
3939
this.locations = newLocations;
40-
this.onPropertyChanged();
40+
this.onShapeChanged();
4141
}
4242

4343
protected List<Sector> computeSectors(DrawContext dc)

src/gov/nasa/worldwind/render/SurfaceText.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void setText(CharSequence text)
123123

124124
this.text = text;
125125
this.textBounds = null; // Need to recompute bounds
126-
this.updateModifiedTime();
126+
this.onShapeChanged();
127127
}
128128

129129
/** {@inheritDoc} */
@@ -150,7 +150,7 @@ public void setPosition(Position position)
150150
}
151151

152152
this.location = position;
153-
this.updateModifiedTime();
153+
this.onShapeChanged();
154154
}
155155

156156
/** {@inheritDoc} */
@@ -174,7 +174,7 @@ public void setFont(Font font)
174174
{
175175
this.font = font;
176176
this.textBounds = null; // Need to recompute bounds
177-
this.updateModifiedTime();
177+
this.onShapeChanged();
178178
}
179179
}
180180

@@ -197,7 +197,7 @@ public void setColor(Color color)
197197
if (!color.equals(this.color))
198198
{
199199
this.color = color;
200-
this.updateModifiedTime();
200+
this.onShapeChanged();
201201
}
202202
}
203203

@@ -220,7 +220,7 @@ public void setBackgroundColor(Color background)
220220
if (bgColor == null || !bgColor.equals(background))
221221
{
222222
this.bgColor = background;
223-
this.updateModifiedTime();
223+
this.onShapeChanged();
224224
}
225225
}
226226

@@ -271,7 +271,7 @@ public void setOffset(Offset offset)
271271
if (!offset.equals(this.offset))
272272
{
273273
this.offset = offset;
274-
this.updateModifiedTime();
274+
this.onShapeChanged();
275275
}
276276
}
277277

0 commit comments

Comments
 (0)