Exemplo n.º 1
0
        public IKmlFolder[] split(int index, IKmlFolder raw, IKmlPlacemark _point, String style)
        {
            IKmlFolder[] output = new IKmlFolder[2];

            String     col   = randomCol();
            IKmlFolder temp1 = ge.createFolder("");
            IKmlFolder temp2 = ge.createFolder("");

            temp1.setName("Trip_" + (index).ToString());
            temp2.setName("Trip_" + (index + 1).ToString());

            int            sw     = 0;
            IKmlObjectList points = raw.getFeatures().getChildNodes();

            for (int i = 0; i != points.getLength(); i++)
            {
                IKmlPlacemark point = (IKmlPlacemark)points.item(i);
                if (point.getName() == _point.getName())
                {
                    sw = 1;
                }
                if (sw == 0)
                {
                    temp1.getFeatures().appendChild(point);
                }
                else
                {
                    IKmlStyleMap sm = ge.createStyleMap("");
                    if (style != null)
                    {
                        if (point.getGeometry().getType() != "KmlPoint")
                        {
                            IKmlStyle sty = ge.createStyle("");
                            sty.getLineStyle().setWidth((float)4);
                            sty.getLineStyle().getColor().set(style);
                            point.setStyleSelector(sty);
                        }
                        else
                        {
                            IKmlStyle normal    = mkStyle(style, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3);
                            IKmlStyle highlight = mkStyle(style, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4);
                            sm.setNormalStyle(normal);
                            sm.setHighlightStyle(highlight);
                            point.setStyleSelector(sm);
                        }
                    }
                    else
                    {
                        if (point.getGeometry().getType() != "KmlPoint")
                        {
                            IKmlStyle sty = ge.createStyle("");
                            sty.getLineStyle().setWidth((float)4);
                            sty.getLineStyle().getColor().set(col);
                            point.setStyleSelector(sty);
                        }
                        else
                        {
                            IKmlStyle normal    = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.3);
                            IKmlStyle highlight = mkStyle(col, @"http://maps.google.com/mapfiles/kml/paddle/wht-blank.png", (float)0.4);
                            sm.setNormalStyle(normal);
                            sm.setHighlightStyle(highlight);
                            point.setStyleSelector(sm);
                        }
                    }
                    temp2.getFeatures().appendChild(point);
                }
            }
            output[0] = temp1;
            output[1] = temp2;
            return(output);
        }