Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,15 @@ public static String setSVGFrameColors(String symbolID, String svg, Color stroke
if((SymbolID.getSymbolSet(symbolID)==SymbolID.SymbolSet_LandInstallation && SymbolID.getFrameShape(symbolID)=='0') ||
SymbolID.getFrameShape(symbolID)==SymbolID.FrameShape_LandInstallation)
{
int i1 = returnSVG.indexOf("<rect") + 5;
if(ver >= SymbolID.Version_2525E && affiliation == SymbolID.StandardIdentity_Affiliation_AssumedFriend)
i1 = returnSVG.indexOf("<rect",i1) + 5;
int i1 = findInstIndIndex(returnSVG)+5;
//make sure installation indicator matches line color
returnSVG = returnSVG.substring(0,i1) + " fill=\"" + hexStrokeColor + "\"" + returnSVG.substring(i1);
}
}
else if((SymbolID.getSymbolSet(symbolID)==SymbolID.SymbolSet_LandInstallation && SymbolID.getFrameShape(symbolID)=='0') ||
SymbolID.getFrameShape(symbolID)==SymbolID.FrameShape_LandInstallation)
{
int i1 = returnSVG.indexOf("<rect") + 5;
if(ver >= SymbolID.Version_2525E && affiliation == SymbolID.StandardIdentity_Affiliation_AssumedFriend)
i1 = returnSVG.indexOf("<rect",i1) + 5;
int i1 = findInstIndIndex(returnSVG)+5;
//No line color change so make sure installation indicator stays black
returnSVG = returnSVG.substring(0,i1) + " fill=\"#000000\"" + returnSVG.substring(i1);
}
Expand Down Expand Up @@ -525,6 +521,27 @@ public static float findWidestStrokeWidth(String svg) {
return largest * OUTLINE_SCALING_FACTOR;
}

public static int findInstIndIndex(String svg)
{
int start = -1;
int stop = -1;

start = svg.indexOf("<rect");
stop = svg.indexOf(">",start);

String rect = svg.substring(start,stop+1);
if(rect.contains("fill"))//no set fill so it's the indicator
{
return start;
}
else //it's the next rect
{
start = svg.indexOf("<rect",stop);
}

return start;
}

public static int getDistanceBetweenPoints(Point2D pt1, Point2D pt2)
{
int distance = (int)(Math.sqrt(Math.pow((pt2.getX() - pt1.getX()) ,2) + Math.pow((pt2.getY() - pt1.getY()) ,2)));
Expand Down