private void btComp_Click(object sender, EventArgs e) { string path = ""; if (sodb_Connected()) if (XFiles.dialFile(ref fdataDir, "Files (*.dm)|*.dm", "Сравнить карту", null, true, out path)) { string s = Path.GetFileName(path) + "..."; beginProcess(s); DBLoaderMap loader = new DBLoaderMap(); string log = Path.ChangeExtension(path, ".log"); var doc = new sodbFeatureToText(log); loader.message = __message; loader.workDir(dmw.WorkDir()); loader.exec(path, fsodb, doc, LoaderMapMode.Compare); doc.Close(); doc = null; endProcess(); } }
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; }