Skip to content

Commit

Permalink
svg and canvas fixes for when converter passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
Spinelli committed Dec 21, 2016
1 parent f2014bf commit 2a597cb
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 41 deletions.
97 changes: 59 additions & 38 deletions web/js/src/sec/web/renderer/MultiPointHandlerCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ sec.web.renderer.MultiPointHandlerCanvas = (function () {

var labelInfo = tempModifier;
var tempLocation = tempModifier.getModifierStringPosition();
var oldLocation = null;
//multipoint renderer is assuming text is centered vertically
//so we add half height to location as text is drawn cetered at
//the bottom.

if(converter)//map specific converter
{
oldLocation = tempLocation;
tempLocation = ipc.PixelsToGeo(tempLocation);
tempLocation = converter.GeoToPixels(tempLocation);
}
Expand Down Expand Up @@ -161,40 +163,65 @@ sec.web.renderer.MultiPointHandlerCanvas = (function () {
//make the canvas grow out of control.
//if (tiTemp && bbox.containsRectangle(bounds))
//if(bbox !== null)
if (tiTemp && bbox !== null && (bbox.intersects(bounds) || bbox.intersects(rotatedBounds)))
if(tiTemp)
{
labels.push(tiTemp);
if (labelBounds)
if (converter)
{
if(rotatedBounds)
labelBounds.union(rotatedBounds);
else if(bounds)
labelBounds.union(bounds);
var preConvRect = new armyc2.c2sd.renderer.so.Rectangle(oldLocation.getX(),oldLocation.getY(),bounds.getWidth(),bounds.getHeight());
if((bbox.intersects(preConvRect)))// || bbox.intersects(rotatedBounds)))
{
labels.push(tiTemp);
if (labelBounds)
{
if(rotatedBounds)
labelBounds.union(rotatedBounds);
else if(bounds)
labelBounds.union(bounds);
}
else
{
if(rotatedBounds)
labelBounds = rotatedBounds;
else if(bounds)
labelBounds = bounds;
}
}
}
else
else if (bbox && (bbox.intersects(bounds) || bbox.intersects(rotatedBounds)))
{
if(rotatedBounds)
labelBounds = rotatedBounds;
else if(bounds)
labelBounds = bounds;
}
}
else if (tiTemp && bbox === null)
{
labels.push(tiTemp);
if (labelBounds)
{
if(rotatedBounds)
labelBounds.union(rotatedBounds);
else if(bounds)
labelBounds.union(bounds);
labels.push(tiTemp);
if (labelBounds)
{
if(rotatedBounds)
labelBounds.union(rotatedBounds);
else if(bounds)
labelBounds.union(bounds);
}
else
{
if(rotatedBounds)
labelBounds = rotatedBounds;
else if(bounds)
labelBounds = bounds;
}
}
else
else if (bbox === null)
{
if(rotatedBounds)
labelBounds = rotatedBounds;
else if(bounds)
labelBounds = bounds;
labels.push(tiTemp);
if (labelBounds)
{
if(rotatedBounds)
labelBounds.union(rotatedBounds);
else if(bounds)
labelBounds.union(bounds);
}
else
{
if(rotatedBounds)
labelBounds = rotatedBounds;
else if(bounds)
labelBounds = bounds;
}
}
}
}//*/
Expand Down Expand Up @@ -288,22 +315,16 @@ sec.web.renderer.MultiPointHandlerCanvas = (function () {
}
else//nothing to draw
{
geoCoordTL = new armyc2.c2sd.graphics2d.Point2D();
geoCoordBR = new armyc2.c2sd.graphics2d.Point2D();
geoCoordTL.setLocation(0,0);
geoCoordBR.setLocation(0,0);
geoCoordTR = new armyc2.c2sd.graphics2d.Point2D();
geoCoordBL = new armyc2.c2sd.graphics2d.Point2D();
geoCoordTR.setLocation(0,0);
geoCoordBL.setLocation(0,0);
geoCoordTL = new armyc2.c2sd.graphics2d.Point2D(0,0);
geoCoordBR = new armyc2.c2sd.graphics2d.Point2D(0,0);
geoCoordTR = new armyc2.c2sd.graphics2d.Point2D(0,0);
geoCoordBL = new armyc2.c2sd.graphics2d.Point2D(0,0);

north = new armyc2.c2sd.graphics2d.Point2D(0,0);
south = new armyc2.c2sd.graphics2d.Point2D(0,0);
east = new armyc2.c2sd.graphics2d.Point2D(0,0);
west = new armyc2.c2sd.graphics2d.Point2D(0,0);
}


}
catch (err)
{
Expand Down
3 changes: 0 additions & 3 deletions web/js/src/sec/web/renderer/MultiPointHandlerSVG.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ sec.web.renderer.MultiPointHandlerSVG = (function () {
labelBounds = bounds;
}
}

else if (bbox === null)
{
labels.push(tiTemp);
Expand Down Expand Up @@ -311,8 +310,6 @@ sec.web.renderer.MultiPointHandlerSVG = (function () {
east = new armyc2.c2sd.graphics2d.Point2D(0,0);
west = new armyc2.c2sd.graphics2d.Point2D(0,0);
}


}
catch (err)
{
Expand Down

0 comments on commit 2a597cb

Please sign in to comment.