public virtual string[] ToArray()
 {
     return(new string[] {
         ClippingRegionItem.GetCaption(),
         GeographyItem.GetCaption(),
     });
 }
 public CountrySave(ClippingRegionItem country,
                    Geography oldGeography, Geography newGeography)
 {
     this.current      = country;
     this.oldGeography = oldGeography;
     this.newGeography = newGeography;
 }
 public GradientSave(Gradient current, bool fileAdded, bool fileDeleted, string table, string filename, ClippingRegionItem currentCountry)
 {
     this.current        = current;
     this.fileAdded      = fileAdded;
     this.fileDeleted    = fileDeleted;
     this.table          = table;
     this.filename       = filename;
     this.currentCountry = currentCountry;
 }
 public ClippingRegionItemGeographyItem(ClippingRegionGeography current, int geographyItemId, int clippingRegionItemId, double percent)
     : this()
 {
     ClippingRegionGeography = current;
     GeographyItem           = new GeographyItem();
     GeographyItem.Id        = geographyItemId;
     ClippingRegionItem      = new ClippingRegionItem();
     ClippingRegionItem.Id   = clippingRegionItemId;
     IntersectionPercent     = percent;
 }
Example #5
0
 private void DeleteRecursiveItems(ClippingRegionItem item)
 {
     foreach (var ci in item.Children)
     {
         Progress.Total++;
         DeleteRecursiveItems(ci);
         Progress.Increment();
     }
     item.ClippingRegion.ClippingRegionItems.Remove(item);
     toDelete.Add(item.Id.Value);
 }
Example #6
0
 public void LoadData(ClippingRegionItem coverage)
 {
     using (new WaitCursor())
     {
         current = coverage;
         // initializa el arbol
         TreeNode t = CreateNode(UI.CurrentCountry);
         AddChildren(t);
         t.Expand();
     }
 }
Example #7
0
 public ClippingRegionSave(ClippingRegion current, bool fileAdded, string iParent,
                           string iCode, string iCaption, string Basename, ClippingRegionItem country)
 {
     this.current   = current;
     this.fileAdded = fileAdded;
     this.iParent   = iParent;
     this.iCode     = iCode;
     this.iCaption  = iCaption;
     this.Basename  = Basename;
     this.country   = country;
 }
Example #8
0
        private void SaveItems(Dictionary <string, int> ci)
        {
            if (!fileAdded)
            {
                return;
            }

            Progress.Caption = "Leyendo ítems";
            var features = ShapeFile.ReadShapefile(Basename + ".shp");

            Progress.Caption = "Preparando ítems";

            current.ClippingRegionItems.Clear();
            Progress.Total = 0;
            Progress.Total = features.Count;
            foreach (var feature in features)
            {
                ClippingRegionItem item = new ClippingRegionItem();
                item.Centroid = (Point)feature.Geometry.Centroid;
                item.Code     = feature.Attributes[iCode].ToString();
                if (iCaption != "")
                {
                    item.Caption = feature.Attributes[iCaption].ToString();
                }
                if (item.Caption.Contains("\n"))
                {
                    item.Caption = item.Caption.Split('\n')[0];
                }
                if (ci != null)
                {
                    var parent = feature.Attributes[iParent].ToString();
                    item.Parent = new ClippingRegionItem(ci[parent]);
                }
                else
                {
                    item.Parent = country;
                }

                item.Geometry   = (Geometry)feature.Geometry;
                item.GeometryR1 = (Geometry)Simplifications.Simplify(feature.Geometry, QualityEnum.High);

                item.ClippingRegion = current;
                current.ClippingRegionItems.Add(item);
                Progress.Increment();
            }

            Progress.Caption = "Guardando ítems";

            var sql = InsertGenerator.FromList(current.ClippingRegionItems);

            context.Data.Session.SqlActions.BulkInsert(sql, Progress);
            context.Data.Session.Flush();
            current.ClippingRegionItems.Clear();
        }
 public void LoadData(ClippingRegionItem country)
 {
     current             = country;
     txtDescription.Text = country.Caption;
     using (new WaitCursor())
     {
         var parents = UI.GetGeographies();
         cmbGeography.FillRecursive(parents);
         currentGeography = UI.GetItems <Geography>().Where(x => x.Country == country && x.IsTrackingLevel).FirstOrDefault();
         if (currentGeography != null)
         {
             cmbGeography.SelectItem(currentGeography);
         }
     }
 }
Example #10
0
        private TreeNode CreateNode(ClippingRegionItem item, TreeNode parent = null)
        {
            TreeNode t = new TreeNode(item.Caption);

            t.Tag = item;

            if (parent == null)
            {
                tvRegions.Nodes.Add(t);
            }
            else
            {
                parent.Nodes.Add(t);
            }
            return(t);
        }
Example #11
0
 private void AddChildren(TreeNode node)
 {
     using (new WaitCursor())
     {
         if (node.Tag is ClippingRegionItem)
         {
             ClippingRegionItem clippingRegionItem = node.Tag as ClippingRegionItem;
             if (clippingRegionItem.ClippingRegion.Parent == null)
             {
                 // es country
                 var regions = UI.GetItems <ClippingRegion>().Where(x => x.Country == UI.CurrentCountry && x.Parent.Parent == null).OrderBy(x => x.Caption).ToList();
                 foreach (var r in regions)
                 {
                     CreateNode(r, node);
                 }
             }
             else
             {
                 if (clippingRegionItem.ClippingRegion.Children.Count > 1)
                 {
                     foreach (var r in clippingRegionItem.ClippingRegion.Children)
                     {
                         CreateNode(r, node);
                     }
                 }
                 else
                 {
                     foreach (var r in clippingRegionItem.Children)
                     {
                         CreateNode(r, node);
                     }
                 }
             }
         }
         else if (node.Tag is ClippingRegion)
         {
             ClippingRegion clippingRegion = node.Tag as ClippingRegion;
             var            items          = UI.GetItems <ClippingRegionItem>().Where(x => x.ClippingRegion == clippingRegion &&
                                                                                      x.Parent == (node.Parent.Tag as ClippingRegionItem)).OrderBy(x => x.Caption).ToList();
             foreach (var r in items)
             {
                 CreateNode(r, node);
             }
         }
     }
 }