Beispiel #1
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            fclient = new client();
            fclient.OnRect=__frag;

            fsodb = new sodb();
            fsodb.status = __status;
            fsodb.message = __message;
            fsodb.endTask = __endTask;

            login_.Text = "niitp";
            password_.Text = "niitp";

            Enabled_ctrls();
        }
Beispiel #2
0
        void writeAttributes(sodb db, SOAPService.Feature fe, List<string> datatypes)
        {
            List<SOAPService.Attribute> Attributes = fe.Attributes;

            if (Attributes != null)
            foreach (var a in Attributes)

            if (a.Values != null)
            foreach (var v in a.Values)
            if (v.Value != null)
            {

                SOAPService.NumberStringAttrValue vv = v.Value;

                string s = "", t = "";
                if (vv is SOAPService.NumberValue)
                {
                    s = db.NumberToStr(vv as SOAPService.NumberValue);
                    t = "N";
                }
                else if (vv is SOAPService.StringValue)
                {
                    s = (vv as SOAPService.StringValue).Text;
                    t = "S";

                    if (a.IsCompositeAttribute) datatypes.Add(s);
                }

                string typ = a.Type.ToString();

                string k = String.Format("attribute {0}[{1}][{2}]", a.Attr_Id, typ, t);

                if (a.IsCompositeAttribute) k += "[C]";

                writeKeyss(k,s,v.Status);

                SOAPService.Geometry shp = v.Shape;
                if (shp != null)
                {
                    writeKey("Geometry", shp.Key);

                    if (shp.Type == SOAPService.GeometryType.Point)
                    {
                        SOAPService.Point pt = (SOAPService.Point)shp;
                        writePoint(pt);
                    }
                    else
                    if (shp.Type == SOAPService.GeometryType.Polyline)
                    {
                        SOAPService.Polyline ln = (SOAPService.Polyline)shp;
                        writePolyline(ln);
                    }
                    else
                    if (shp.Type == SOAPService.GeometryType.Polygon)
                    {
                        SOAPService.Polygon rgn = (SOAPService.Polygon)shp;
                        writePolygon(rgn);
                    }
                }

                writeMetadatas(db,v.Metadata,a.Attr_Id);
               }
        }
Beispiel #3
0
 public void Features(sodb db,  List<SOAPService.Feature> list)
 {
     fcount+=list.Count;
     foreach (var fe in list)
     writeFeature(db,list,fe);
 }
Beispiel #4
0
        void writeMetadatas(sodb db, List<SOAPService.Metadata> list, string capt)
        {
            if (db.MetadataExists(list))
            {
                file.WriteLine("metadata " + capt + " {");

                foreach (var m in list)
                    writeMetaData(db,m, "\t");

                file.WriteLine("}");
            }
        }
Beispiel #5
0
        void writeMetaData(sodb db, SOAPService.Metadata m, string tab)
        {
            string s = tab + "\"" + m.Akronim + "\" \"" + m.Metadata_Cl_Id + "\"";

            if (m.Status != SOAPService.EditableStatus.Unchanged)
            s += " " + fdb.EditableStatusStr(m.Status);

            if (m.IsCompositeAttribute)
            {
                if (db.MetadataExists(m.CompositeMetadata))
                {
                    file.WriteLine(s);
                    file.WriteLine(tab + "{");

                    if (m.CompositeMetadata != null)
                    if (m.CompositeMetadata.Count > 0)
                    foreach (var m1 in m.CompositeMetadata)
                    writeMetaData(db,m1, tab + "\t");

                    file.WriteLine(tab + "}");
                }
            }
            else
            {
                string t = "";
                if (m.Values != null)
                    foreach (var v in m.Values)
                    {
                        if (t.Length > 0) t += " ";

                        if (v.Status != SOAPService.EditableStatus.Unchanged)
                        t += "/" + fdb.EditableStatusStr(v.Status) + "/ ";

                        t+="\"" + v.Value + "\"";
                    }

                if (t.Length > 0)
                file.WriteLine(s+" "+t);
            }
        }
Beispiel #6
0
        void writeFeature(sodb db,  List<SOAPService.Feature> list, SOAPService.Feature fe)
        {
            fdb = db;

            file.WriteLine("{");

            writeKey("Key", fe.Key);
            writeKey("Acronym", fe.Cl_Id);

            writeMetadatas(db,fe.Metadata, "object");

            SOAPService.Point pt = fe.BaseShapePoint;
            SOAPService.Polyline ln = fe.BaseShapePolyline;
            SOAPService.Polygon rgn = fe.BaseShapePolygon;

            if (pt != null)
            {
                writePoint(pt);
                writeMetadatas(db,pt.Metadata, "point");
            }

            if (ln != null)
            {
                writePolyline(ln);
                writeMetadatas(db,ln.Metadata, "polyline");
            }

            if (rgn != null)
            {
                writePolygon(rgn);
                writeMetadatas(db,rgn.Metadata, "polygon");
            }

            List<string> datatypes = new List<string>();
            writeAttributes(db, fe, datatypes);

            List<SOAPService.Relation> relations = fe.Relations;

            if (relations != null)
            foreach (var relation in relations)
            {
                string s;

                s = String.Format("relation {0} role={1}", relation.Key, relation.Role);
                if (relation.Status != SOAPService.EditableStatus.Unchanged)
                s += " " + fdb.EditableStatusStr(relation.Status);

                file.WriteLine(s);

                SOAPService.RelationRule rule = relation.RelationRule;
                if (rule != null)
                {
                    s = String.Format("rule {0} {1} {2} {3} // {4}",
                        rule.Cl_Id, rule.Source.Cl_Id, rule.Target.Cl_Id,
                        rule.Type,rule.Name);
                    file.WriteLine(s);
                }
            }

            file.WriteLine("}");
            file.WriteLine("");

            writeDatatypes(db, list,datatypes);
        }
Beispiel #7
0
 void writeDatatypes(sodb db, List<SOAPService.Feature> list, List<string> keys)
 {
     foreach (var key in keys) {
         foreach (var fe in list)
         if (fe.Key == key) {
             writeFeature(db,list,fe);
             break;
         }
     }
 }
Beispiel #8
0
        public void exec(string path, sodb db, sodbFeatureToText Alog, LoaderMapMode Amode)
        {
            map.OpenMap(path); fdb = db; flog = Alog; fMode = Amode;

            if (map.Enabled != 1)
                __message(String.Format("open map '{0}' false.",path));
            {

                map.IsWGS84=1;
                double x1,y1,x2,y2;
                int pps = map.get_Bound(out x1, out y1, out x2, out y2);
                if (pps != 1)
                    __message("expected world coordinate system.");
                else
                {
                    db.SetExtent(x1 * RadToDeg, y1 * RadToDeg, x2 * RadToDeg, y2 * RadToDeg);

                    session = db.beginUpdate();
                    if (session == null)
                        __message("session == null");
                    {
                        __message(String.Format("session = {0}", session));

                        string err = System.IO.Path.ChangeExtension(path, ".err");
                        ferr.open(err);

                        if (map.Goto_root == 0)
                            __message("Goto_root == 0");
                        else
                            layers();

                        ferr.close();

                        if (IsCompare)
                        {
                            if (fcount == 0)
                                __message("Objects not found.");
                            else {
                                __message(String.Format("Verify {0} objects.", fcount));

                                if (fnot_found + fmodified_sf + fmodified_mf + fmodified_hf + fmodified_meta == 0)
                                    __message("OK.");
                                {
                                    if (fnot_found > 0)
                                        __message(String.Format("*** not found {0} objects.", fnot_found));

                                    if (fmodified_sf > 0)
                                    __message(String.Format("*** acronym: {0} objects.", fmodified_sf));

                                    if (fmodified_mf > 0)
                                    __message(String.Format("*** shapes: {0} objects.", fmodified_mf));

                                    if (fmodified_hf > 0)
                                        __message(String.Format("*** attributes: {0} objects.", fmodified_hf));

                                    if (fmodified_meta > 0)
                                        __message(String.Format("*** metadata: {0} objects.", fmodified_meta));
                                }
                            }

                        } else

                        if (fadded1 + fadded2 + fdeleted + fupdated > 0)
                        {
                            if (fadded1 > 0)
                            __message(String.Format("Add {0} objects.", fadded1));

                            if (fadded2 > 0)
                            __message(String.Format("Add {0} datatypes.", fadded2));

                            if (fdeleted > 0)
                            __message(String.Format("Delete {0} objects.", fdeleted));

                            if (fupdated > 0)
                            __message(String.Format("Update {0} objects.", fupdated));

                            __message("apply Update");

                            if (IsUpdate)
                                db.applyUpdate(session, "UpdateObjects");
                            else
                                db.applyUpdate(session, "LoaderMap");
                        }

                        db.endUpdate(session);
                        __message("end session");
                    }
                }
            }

            map.Close(); fdb = null; flog = null;
        }