Ejemplo n.º 1
0
        public Feature CreateStrassenabschnittFeature(InspektionsRtStrAbschnitte inspektionsroutenAbschnitt, Guid inspektionsrouteid)
        {
            Feature          feature    = new Feature();
            IAttributesTable attributes = new AttributesTable();

            feature.Geometry = inspektionsroutenAbschnitt.StrassenabschnittGIS.Shape;

            //ID
            attributes.AddAttribute(checkStringLengthforDBF(CheckOutGISDefaults.StrassenabschnittGISID), inspektionsroutenAbschnitt.StrassenabschnittGIS.Id.ToString());
            //Reihenfolge
            attributes.AddAttribute(checkStringLengthforDBF(CheckOutGISDefaults.StrassenabschnittReihenfolge), inspektionsroutenAbschnitt.Reihenfolge);
            //Belastungskategorie
            attributes.AddAttribute(checkStringLengthforDBF(CheckOutGISDefaults.BelastungsKategorie), inspektionsroutenAbschnitt.StrassenabschnittGIS.Belastungskategorie.Typ);
            //inspektionsRouteID
            attributes.AddAttribute(checkStringLengthforDBF(CheckOutGISDefaults.InspektionsRouteID), inspektionsrouteid.ToString());

            feature.Attributes = attributes;
            return(feature);
        }
Ejemplo n.º 2
0
        public static void GenerateInspektionsrouten(ISession session, ErfassungsPeriod currentPeriod, IList <StrassenabschnittGIS> strassen)
        {
            var strassenabschnitte      = strassen;
            var inspektionsroutebuilder = Builder <InspektionsRouteGIS> .CreateListOfSize(InspektionasroutenGISCount)
                                          .All()
                                          .With(ir => ir.Mandant          = currentPeriod.Mandant)
                                          .With(ir => ir.ErfassungsPeriod = currentPeriod);

            var inspektionsrouten         = inspektionsroutebuilder.Build();
            int strabsperInspektionsroute = (int)(Math.Floor((double)(strassenabschnitte.Count / inspektionsrouten.Count / 2)));
            int saIndex = 1;

            foreach (InspektionsRouteGIS inspektionsRoute in inspektionsrouten)
            {
                IList <InspektionsRtStrAbschnitte> irabsList = new List <InspektionsRtStrAbschnitte>();
                IGeometry shape = null;
                for (int i = 0; i < strabsperInspektionsroute; i++)
                {
                    InspektionsRtStrAbschnitte irabs = new InspektionsRtStrAbschnitte();
                    irabs.StrassenabschnittGIS = strassenabschnitte[saIndex];
                    irabs.InspektionsRouteGIS  = inspektionsRoute;
                    irabs.Reihenfolge          = i;
                    irabsList.Add(irabs);

                    if (shape != null)
                    {
                        shape = shape.Union(strassenabschnitte[saIndex].Shape);
                    }
                    else
                    {
                        shape = strassenabschnitte[saIndex].Shape;
                    }
                    saIndex++;
                    session.Save(irabs);
                }
                inspektionsRoute.InspektionsRtStrAbschnitteList = irabsList;
                inspektionsRoute.Shape = shape;

                session.Save(inspektionsRoute);
            }
        }