hasModifier/canSymbolHaveModifier Failure
NOTE: hasModifier calls canSymbolHaveModifier
A canSymbolHaveModifier call can fall if the specified symbol only has a single a single modifier in the XML file. For example, the following code will return false instead of true.
boolean result = SymbolUtilities.canHaveSymbolModifier("G*T*L-----****X", "W", 1);
I believe that this is because the SymbolConstantsC.xml contains the following definition of the symbol.
<SYMBOL>
<SYMBOLID>G*T*L-----****X</SYMBOLID>
<GEOMETRY>line</GEOMETRY>
<DRAWCATEGORY>15</DRAWCATEGORY>
<MAXPOINTS>3</MAXPOINTS>
<MINPOINTS>3</MINPOINTS>
<MODIFIERS>W</MODIFIERS>
<DESCRIPTION>Delay</DESCRIPTION>
<HIERARCHY>2.X.1.8</HIERARCHY>
<ALPHAHIERARCHY>TACGRP.TSK.DLY</ALPHAHIERARCHY>
<PATH>Tactical Graphics/Tasks</PATH>
</SYMBOL>
Note that in the MODIFIERS element, the modifier code exists ("W"). However, the code looks for the code with a period appended (i.e., it is looking for "W."). This occurs in two places in the code (see =====>). The code needs to change or the XML needs to change.
public static boolean canSymbolHaveModifier(String symbolID, String tgModifier, int symStd)
{
String basic = null;
SymbolDef sd = null;
boolean returnVal = false;
try
{
basic = SymbolUtilities.getBasicSymbolID(symbolID);
sd = SymbolDefTable.getInstance().getSymbolDef(basic, symStd);
if(sd != null)
{
int dc = sd.getDrawCategory();
if(tgModifier.equals(ModifiersTG.AM_DISTANCE))
{
switch(dc)
{
case SymbolDef.DRAW_CATEGORY_RECTANGULAR_PARAMETERED_AUTOSHAPE:
case SymbolDef.DRAW_CATEGORY_SECTOR_PARAMETERED_AUTOSHAPE:
case SymbolDef.DRAW_CATEGORY_TWO_POINT_RECT_PARAMETERED_AUTOSHAPE:
returnVal = true;
break;
case SymbolDef.DRAW_CATEGORY_CIRCULAR_PARAMETERED_AUTOSHAPE:
case SymbolDef.DRAW_CATEGORY_CIRCULAR_RANGEFAN_AUTOSHAPE:
returnVal = true;
break;
case SymbolDef.DRAW_CATEGORY_LINE:
======> if(sd.getModifiers().indexOf(tgModifier + ".")>-1)
returnVal = true;
break;
default:
returnVal = false;
}
}
else if(tgModifier.equals(ModifiersTG.AN_AZIMUTH))
{
switch(dc)
{
case SymbolDef.DRAW_CATEGORY_RECTANGULAR_PARAMETERED_AUTOSHAPE:
case SymbolDef.DRAW_CATEGORY_SECTOR_PARAMETERED_AUTOSHAPE:
returnVal = true;
break;
default:
returnVal = false;
}
}
else
{
======> sd.getModifiers().indexOf(tgModifier + ".")>-1)
returnVal = true;
}
}
return returnVal;
}
catch(Exception exc)
{
ErrorLogger.LogException("SymbolUtilties", "canSymbolHaveModifier", exc);
}
return returnVal;
}
Fixing the XML. Had another released planned so will incorporate into that.
Thank you.
David Melendez
mailto:[email protected] [email protected]
Software Engineer
Nova Tech Solutions
From: Michael Spinelli [mailto:[email protected]] Sent: Tuesday, October 4, 2016 2:45 PM To: missioncommand/mil-sym-java [email protected] Cc: david-melendez [email protected]; Author [email protected] Subject: Re: [missioncommand/mil-sym-java] hasModifier/canSymbolHaveModifier Failure (#28)
Fixing the XML. Had another released planned so will incorporate into that.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/missioncommand/mil-sym-java/issues/28#issuecomment-251492050 , or mute the thread https://github.com/notifications/unsubscribe-auth/AVkzU0rFdrYWaF3Xi9BxG-o_wpbs30TXks5qwqzCgaJpZM4KOBqG . https://github.com/notifications/beacon/AVkzU4TGHn5sHRsLtk2JzqVEE4RInjj1ks5qwqzCgaJpZM4KOBqG.gif
No virus found in this message. Checked by AVG - www.avg.com http://www.avg.com Version: 2016.0.7797 / Virus Database: 4656/13147 - Release Date: 10/04/16
No virus found in this message. Checked by AVG - www.avg.com http://www.avg.com Version: 2016.0.7797 / Virus Database: 4656/13135 - Release Date: 10/02/16
fixed in v0.1.15, issue#29 will be resolved in next release