private PMSymbol GetAreaSymbol(Collection <string> symbolValues, ref int penUpIndex, int drawingIndex, int ringStartIndex, int ringEndIndex) { PMSymbol areaSymbol = new PMSymbol(); // set fill pattern symbol int fillIndex = IndexOfSymbolValue(symbolValues, ringStartIndex + 1, symbolValues.Count, "FP", "EP"); areaSymbol.FillPatternSymbol = new PFSymbol(symbolValues[fillIndex]); AreaShapeFillPattern fillPattern = areaSymbol.FillPatternSymbol.GetFillPattern(); // set transparency symbol if (fillPattern == AreaShapeFillPattern.Fill) { int transIndex = LastIndexOfSymbolValue(symbolValues, 0, ringStartIndex, "ST"); if (transIndex == -1) { areaSymbol.TransparencySymbol = new STSymbol("ST0"); } else { areaSymbol.TransparencySymbol = new STSymbol(symbolValues[transIndex]); } } else { areaSymbol.TransparencySymbol = new STSymbol(); } // set ring symbols int outerRingEndIndex = IndexOfSymbolValue(symbolValues, ringStartIndex + 1, fillIndex - 1, "PM1"); if (outerRingEndIndex == -1) { areaSymbol.OuterRingSymbols = GetRingSymbols(symbolValues, fillPattern, ref penUpIndex, drawingIndex, ringEndIndex); } else { areaSymbol.OuterRingSymbols = GetRingSymbols(symbolValues, fillPattern, ref penUpIndex, drawingIndex, outerRingEndIndex); drawingIndex = IndexOfSymbolValue(symbolValues, penUpIndex + 1, symbolValues.Count - 1, "PD", "CI", "AA"); areaSymbol.InnerRingSymbols = GetRingSymbols(symbolValues, fillPattern, ref penUpIndex, drawingIndex, ringEndIndex); } return(areaSymbol); }
public Collection <DAIShape> GetDrawingShapes(Dictionary <string, RGBColor> colorRef) { Collection <DAIShape> shapes = new Collection <DAIShape>(); Collection <S52BaseSymbol> symbols = new Collection <S52BaseSymbol>(); // get all symbol values Collection <string> symbolValues = vectorCommands; int penUpIndex = IndexOfSymbolValue(symbolValues, 0, symbolValues.Count, "PU"); int ringEndIndex = 0; while (penUpIndex != -1) { int drawingIndex = IndexOfSymbolValue(symbolValues, penUpIndex + 1, symbolValues.Count - 1, "PD", "CI", "AA"); int ringStartIndex = IndexOfSymbolValue(symbolValues, ringEndIndex + 1, drawingIndex - 1, "PM0"); if (ringStartIndex == -1 && drawingIndex != -1) { PUSymbol singleSymbol = GetSingleSymbolWithWidth(symbolValues, penUpIndex, ref drawingIndex); //singleSymbols.Add(singleSymbol); symbols.Add(singleSymbol); penUpIndex = IndexOfSymbolValue(symbolValues, drawingIndex + 1, symbolValues.Count - 1, "PU"); } else if (ringStartIndex == -1 && drawingIndex == -1) { penUpIndex = -1; } else { ringEndIndex = IndexOfSymbolValue(symbolValues, ringStartIndex + 1, symbolValues.Count, "PM2"); PMSymbol areaSymbol = GetAreaSymbol(symbolValues, ref penUpIndex, drawingIndex, ringStartIndex, ringEndIndex); //areaSymbols.Add(areaSymbol); symbols.Add(areaSymbol); } } //// get shapes from area symbols //foreach (PMSymbol areaSymbol in areaSymbols) //{ // AreaShape areaShape = areaSymbol.GetAreaShape(colorRef); // shapes.Add(areaShape); //} //// get shapes from single symbols //foreach (PUSymbol singleSymbol in singleSymbols) //{ // Collection<DAIShape> singleShapes = singleSymbol.GetShapes(colorRef); // foreach (DAIShape shape in singleShapes) // { // shapes.Add(shape); // } //} foreach (S52BaseSymbol symbol in symbols) { if (symbol is PUSymbol) { Collection <DAIShape> singleShapes = (symbol as PUSymbol).GetShapes(colorRef); foreach (DAIShape shape in singleShapes) { shapes.Add(shape); } } else if (symbol is PMSymbol) { AreaShape areaShape = (symbol as PMSymbol).GetAreaShape(colorRef); shapes.Add(areaShape); } } return(shapes); }