Beispiel #1
0
        private bool GetGroupHeight(TableItem check, TableGroup parent, ref float height)
        {
            height += GroupHeight;

            if (parent.Expanded)
            {
                //Add sub groups
                foreach (TableGroup subgroup in parent.Groups)
                {
                    if (subgroup == check)
                    {
                        return(true);
                    }
                    if (GetGroupHeight(check, subgroup, ref height))
                    {
                        return(true);
                    }
                }

                //Add sub rows
                if (GetRowsHeight(check, parent, ref height))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        public virtual bool OnMouseDown(System.Windows.Forms.MouseEventArgs e)
        {
            //Only consider left button
            if (e.Button != MouseButtons.Left)
            {
                return(false);
            }

            Diagram diagram  = GetDiagram();
            PointF  location = diagram.PointToDiagram(e);
            PointF  local    = PointToElement(location);

            TableItem old = SelectedItem;

            SelectedItem = GetTableItemFromLocation(local);
            if (SelectedItem != old && Selected)
            {
                return(true);
            }

            //Check to see if any groups can be expanded
            TableGroup group = GetTableGroupExpander(Groups, local);

            if (group != null)
            {
                group.Expanded = !group.Expanded;
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        //Handles events for rows and groups
        private void TableItems_InsertItem(object sender, TableItemsEventArgs e)
        {
            //Check isnt same group
            if (e.Value == this)
            {
                throw new TableItemsException("Cannot add a TableGroup to itself.");
            }

            if (Table != null)
            {
                e.Value.SetTable(Table);
                e.Value.SetIndent(Indent + Table.Indent);
            }
            e.Value.SetParent(this);
            e.Value.TableItemInvalid += new EventHandler(TableItem_TableItemInvalid);

            if (e.Value is TableGroup)
            {
                TableGroup group = (TableGroup)e.Value;

                group.ExpandedChanged += new ExpandedChangedEventHandler(TableGroup_ExpandedChanged);
                group.HeightChanged   += new EventHandler(TableGroup_HeightChanged);
            }

            OnHeightChanged(this, EventArgs.Empty);
            OnTableItemInvalid();
        }
Beispiel #4
0
        //Fired when a group or top level row is added to the table
        private void TableItems_InsertItem(object sender, TableItemsEventArgs e)
        {
            TableItem item = e.Value;

            //Set common values and event handlers for row or group
            item.SetTable(this);
            item.Backcolor = GradientColor;

            //If is a row then set the indent
            if (item is TableRow)
            {
                item.SetIndent(Indent);
            }

            if (item is TableGroup)
            {
                TableGroup group = (TableGroup)item;
                group.HeightChanged   += new EventHandler(TableGroup_HeightChanged);
                group.ExpandedChanged += new ExpandedChangedEventHandler(TableGroup_ExpandedChanged);

                //Set all the table references correctly
                group.SetTable();
            }

            item.TableItemInvalid += new EventHandler(TableItems_TableItemInvalid);

            SetHeight();

            //Make sure diagram is redrawn
            OnElementInvalid();
        }
Beispiel #5
0
        //Returns the first visible group or row from the item provided.
        private TableItem GetVisibleItem(TableItem item)
        {
            List <TableItem> list = new List <TableItem>();

            list.Add(item);

            TableItem child = item;

            //Create a list parent items
            while (child.Parent != null)
            {
                list.Insert(0, child.Parent);
                child = child.Parent;
            }

            //Loop through list and find bottom most viisble item
            foreach (TableItem loop in list)
            {
                if (loop is TableGroup)
                {
                    TableGroup group = loop as TableGroup;
                    if (!group.Expanded)
                    {
                        return(group);
                    }
                }
            }

            return(item);
        }
Beispiel #6
0
        public virtual bool ExecuteMouseCommand(MouseCommand command)
        {
            //Only consider left button
            if (command.MouseButtons != MouseCommandButtons.Left)
            {
                return(false);
            }

            //Only process mouse down
            if (command is MouseDownCommand)
            {
                PointF location = command.Location; //view.PointToDiagram(e.X, e.Y);
                PointF local    = PointToElement(location);

                TableItem old = SelectedItem;
                SelectedItem = GetTableItemFromLocation(local);
                if (SelectedItem != old && Selected)
                {
                    return(true);
                }

                //Check to see if any groups can be expanded
                TableGroup group = GetTableGroupExpander(Groups, local);
                if (group != null)
                {
                    group.Expanded = !group.Expanded;
                    return(true);
                }
            }

            return(false);
        }
		public TableGroup(TableGroup prototype): base(prototype)
		{
			mExpanded = prototype.Expanded;
			Rows = new TableItems(typeof(TableRow));
			Groups = new TableItems(typeof(TableGroup));
			Table.CopyRows(prototype.Rows,Rows);
			Table.CopyGroups(prototype.Groups, Groups);
		}
 public TableGroup(TableGroup prototype) : base(prototype)
 {
     mExpanded = prototype.Expanded;
     Rows      = new TableItems(typeof(TableRow));
     Groups    = new TableItems(typeof(TableGroup));
     Table.CopyRows(prototype.Rows, Rows);
     Table.CopyGroups(prototype.Groups, Groups);
 }
Beispiel #9
0
 public TableGroup(TableGroup prototype) : base(prototype)
 {
     _expanded = prototype.Expanded;
     Rows      = new TableRows();
     Groups    = new TableGroups();
     Table.CopyRows(prototype.Rows, Rows);
     Table.CopyGroups(prototype.Groups, Groups);
 }
Beispiel #10
0
        private float GetRowsHeight(TableGroup parent)
        {
            float height = 0;

            //Add top level rows
            foreach (TableRow row in parent.Rows)
            {
                height += RowHeight;
            }

            return(height);
        }
Beispiel #11
0
        private bool GetRowsHeight(TableItem check, TableGroup parent, ref float height)
        {
            //Add top level rows
            foreach (TableRow row in parent.Rows)
            {
                if (row == check)
                {
                    return(true);
                }
                height += RowHeight;
            }

            return(false);
        }
Beispiel #12
0
        private void TableItems_RemoveItem(object sender, TableItemsEventArgs e)
        {
            TableItem item = e.Value;

            //Remove handlers
            if (item is TableGroup)
            {
                TableGroup group = (TableGroup)item;
                group.HeightChanged   -= new EventHandler(TableGroup_HeightChanged);
                group.ExpandedChanged -= new ExpandedChangedEventHandler(TableGroup_ExpandedChanged);
            }
            item.TableItemInvalid -= new EventHandler(TableItems_TableItemInvalid);

            SetHeight();
            OnElementInvalid();
        }
Beispiel #13
0
        private void TableItems_RemoveItem(object sender, TableItemsEventArgs e)
        {
            //Remove handlers
            if (e.Value != null)
            {
                e.Value.TableItemInvalid -= new EventHandler(TableItem_TableItemInvalid);

                if (e.Value is TableGroup)
                {
                    TableGroup group = (TableGroup)e.Value;

                    group.ExpandedChanged -= new ExpandedChangedEventHandler(TableGroup_ExpandedChanged);
                    group.HeightChanged   -= new EventHandler(TableGroup_HeightChanged);
                }
            }

            OnHeightChanged(this, EventArgs.Empty);
            OnTableItemInvalid();
        }
Beispiel #14
0
        private TableGroup GetTableGroupExpander(TableItems groups, PointF local)
        {
            foreach (TableGroup group in groups)
            {
                RectangleF expander = new RectangleF(group.Indent + 4, group.Rectangle.Top + 4, 11, 11);
                if (expander.Contains(local))
                {
                    return(group);
                }

                //Sub groups
                TableGroup result = GetTableGroupExpander(group.Groups, local);
                if (result != null)
                {
                    return(result);
                }
            }

            return(null);
        }
Beispiel #15
0
        private float GetGroupHeight(TableGroup parent)
        {
            float height = 0;

            height += GroupHeight;

            if (parent.Expanded)
            {
                //Add sub groups
                foreach (TableGroup subgroup in parent.Groups)
                {
                    height += GetGroupHeight(subgroup);
                }

                //Add sub rows
                height += GetRowsHeight(parent);
            }

            return(height);
        }
        //
        // CONSTRUCTOR
        //
        public RasterBand(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <OIDFieldName>
            XPathNavigator navigatorOIDFieldName = navigator.SelectSingleNode("OIDFieldName");
            if (navigatorOIDFieldName != null) {
                this._oidFieldName = navigatorOIDFieldName.Value;
            }

            // Create Fields Group
            TableGroup tableGroupFields = new TableGroup();
            tableGroupFields.Expanded = true;
            tableGroupFields.Text = "Fields";
            this.Groups.Add(tableGroupFields);

            XPathNodeIterator interatorField = navigator.Select("Fields/FieldArray/Field");
            while (interatorField.MoveNext()) {
                // Create Field
                XPathNavigator navigatorField = interatorField.Current;
                Field field = new Field(navigatorField, this);

                // Add Field To Group
                tableGroupFields.Rows.Add(field);
            }

            // Create Indexes Group
            TableGroup tableGroupIndexes = new TableGroup();
            tableGroupIndexes.Expanded = true;
            tableGroupIndexes.Text = "Indexes";
            this.Groups.Add(tableGroupIndexes);

            XPathNodeIterator interatorIndex = navigator.Select("Indexes/IndexArray/Index");
            while (interatorIndex.MoveNext()) {
                // Add Index
                XPathNavigator navigatorIndex = interatorIndex.Current;
                Index index = new Index(navigatorIndex);
                tableGroupIndexes.Groups.Add(index);

                // Add Field Index
                XPathNodeIterator interatorIndexField = navigatorIndex.Select("Fields/FieldArray/Field");
                while (interatorIndexField.MoveNext()) {
                    XPathNavigator navigatorIndexField = interatorIndexField.Current;
                    IndexField indexField = new IndexField(navigatorIndexField);
                    index.Rows.Add(indexField);
                }
            }

            // <IsInteger>
            XPathNavigator navigatorIsInteger = navigator.SelectSingleNode("IsInteger");
            if (navigatorIsInteger != null) {
                this._isInteger = navigatorIsInteger.ValueAsBoolean;
            }

            // <MeanCellHeight>
            XPathNavigator navigatorMeanCellHeight = navigator.SelectSingleNode("MeanCellHeight");
            if (navigatorMeanCellHeight != null) {
                this._meanCellHeight = navigatorMeanCellHeight.ValueAsDouble;
            }

            // <MeanCellWidth>
            XPathNavigator navigatorMeanCellWidth = navigator.SelectSingleNode("MeanCellWidth");
            if (navigatorMeanCellWidth != null) {
                this._meanCellWidth = navigatorMeanCellWidth.ValueAsDouble;
            }

            // <Height>
            XPathNavigator navigatorHeight = navigator.SelectSingleNode("Height");
            if (navigatorHeight != null) {
                this._height = navigatorHeight.ValueAsInt;
            }

            // <Width>
            XPathNavigator navigatorWidth = navigator.SelectSingleNode("Width");
            if (navigatorWidth != null) {
                this._width = navigatorWidth.ValueAsInt;
            }

            // <PixelType>
            XPathNavigator navigatorPixelType = navigator.SelectSingleNode("PixelType");
            if (navigatorPixelType != null) {
                this._pixelType = GeodatabaseUtility.GetPixelType(navigatorPixelType.Value);
            }

            // <PrimaryField>
            XPathNavigator navigatorPrimaryField = navigator.SelectSingleNode("PrimaryField");
            if (navigatorPrimaryField != null) {
                this._primaryField = navigatorPrimaryField.ValueAsInt;
            }

            // <TableType>
            XPathNavigator navigatorTableType = navigator.SelectSingleNode("TableType");
            if (navigatorTableType != null) {
                this._tableType = (esriRasterTableTypeEnum)Enum.Parse(typeof(esriRasterTableTypeEnum), navigatorTableType.Value, true);
            }

            // <Extent>
            XPathNavigator navigatorExtent = navigator.SelectSingleNode("Extent");
            if (navigatorExtent != null) {
                this._extent = new Extent(navigatorExtent);
            }
            else {
                this._extent = new Extent();
            }

            // <SpatialReference>
            XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference");
            if (navigatorSpatialReference != null) {
                this._spatialReference = new SpatialReference(navigatorSpatialReference);
            }
            else {
                this._spatialReference = new SpatialReference();
            }
        }
        //
        // CONSTRUCTOR
        //
        public ObjectClass(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <OIDFieldName></OIDFieldName>
            XPathNavigator navigatorOIDFieldName = navigator.SelectSingleNode("OIDFieldName");
            if (navigatorOIDFieldName != null) {
                this._oidFieldName = navigatorOIDFieldName.Value;
            }

            // <CLSID></CLSID>
            XPathNavigator navigatorCLSID = navigator.SelectSingleNode("CLSID");
            if (navigatorCLSID != null) {
                if (!string.IsNullOrEmpty(navigatorCLSID.Value)) {
                    this._clsid = navigatorCLSID.Value;
                }
            }

            // <EXTCLSID></EXTCLSID>
            XPathNavigator navigatorEXTCLSID = navigator.SelectSingleNode("EXTCLSID");
            if (navigatorEXTCLSID != null) {
                if (!string.IsNullOrEmpty(navigatorEXTCLSID.Value)) {
                    this._extClsid = navigatorEXTCLSID.Value;
                }
            }

            // <AliasName></AliasName>
            XPathNavigator navigatorAliasName = navigator.SelectSingleNode("AliasName");
            if (navigatorAliasName != null) {
                this._aliasName = navigatorAliasName.Value;
            }

            // <ModelName></ModelName>
            XPathNavigator navigatorModelName = navigator.SelectSingleNode("ModelName");
            if (navigatorModelName != null) {
                this._modelName = navigatorModelName.Value;
            }

            // <GlobalIDFieldName></GlobalIDFieldName>
            XPathNavigator navigatorGlobalIDFieldName = navigator.SelectSingleNode("GlobalIDFieldName");
            if (navigatorGlobalIDFieldName != null) {
                this._globalIDFieldName = navigatorGlobalIDFieldName.Value;
            }

            // <RasterFieldName></RasterFieldName>
            XPathNavigator navigatorRasterFieldName = navigator.SelectSingleNode("RasterFieldName");
            if (navigatorRasterFieldName != null) {
                this._rasterFieldName = navigatorRasterFieldName.Value;
            }

            // <PropertySetProperty></PropertySetProperty>
            this._extensionProperties = new List<Property>();
            XPathNodeIterator interatorPropertySetProperty = navigator.Select("ExtensionProperties/PropertyArray/PropertySetProperty");
            while (interatorPropertySetProperty.MoveNext()) {
                // Get Property Note
                XPathNavigator navigatorPropertySetProperty = interatorPropertySetProperty.Current;

                // Create Property Object
                Property property = new Property(navigatorPropertySetProperty);

                // Store Property Object in List
                this._extensionProperties.Add(property);
            }

            // <SubtypeFieldName></SubtypeFieldName>
            XPathNavigator navigatorSubtypeFieldName = navigator.SelectSingleNode("SubtypeFieldName");
            if (navigatorSubtypeFieldName != null) {
                this._subtypeFieldName = navigatorSubtypeFieldName.Value;
            }

            // Create ESRI Namespace Manager
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(navigator.NameTable);
            namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE);

            // <ControllerMemberships><ControllerMembership></ControllerMembership></ControllerMemberships>
            this._controllerMemberships = new List<ControllerMembership>();
            XPathNodeIterator interatorControllerMembership = navigator.Select("ControllerMemberships/ControllerMembership");
            while (interatorControllerMembership.MoveNext()) {
                // Get ControllerMembership
                XPathNavigator navigatorControllerMembership = interatorControllerMembership.Current;

                // Get Type
                XPathNavigator type = navigatorControllerMembership.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value) {
                    case Xml._GEOMETRICNETWORKMEMBERSHIP:
                        GeometricNetworkControllerMembership geometricNetworkControllerMembership = new GeometricNetworkControllerMembership(navigatorControllerMembership);
                        this._controllerMemberships.Add(geometricNetworkControllerMembership);
                        break;
                    case Xml._TOPOLOGYMEMBERSHIP:
                        TopologyControllerMembership topologyControllerMembership = new TopologyControllerMembership(navigatorControllerMembership);
                        this._controllerMemberships.Add(topologyControllerMembership);
                        break;
                    case Xml._TERRAINMEMBERSHIP:
                        break;
                    case Xml._NETWORKDATASETMEMBERSHIP:
                        NetworkControllerMembership networkControllerMembership = new NetworkControllerMembership(navigatorControllerMembership);
                        this._controllerMemberships.Add(networkControllerMembership);
                        break;
                }
            }

            // Create Fields Group
            TableGroup tableGroupFields = new TableGroup();
            tableGroupFields.Expanded = true;
            tableGroupFields.Text = "Fields";
            this.Groups.Add(tableGroupFields);

            XPathNodeIterator interatorField = navigator.Select("Fields/FieldArray/Field");
            while (interatorField.MoveNext()) {
                // Create Field
                XPathNavigator navigatorField = interatorField.Current;
                Field field = new Field(navigatorField, this);

                // Add Field To Group
                tableGroupFields.Rows.Add(field);
            }

            // Create Indexes Group
            TableGroup tableGroupIndexes = new TableGroup();
            tableGroupIndexes.Expanded = true;
            tableGroupIndexes.Text = "Indexes";
            this.Groups.Add(tableGroupIndexes);

            XPathNodeIterator interatorIndex = navigator.Select("Indexes/IndexArray/Index");
            while (interatorIndex.MoveNext()) {
                // Add Index
                XPathNavigator navigatorIndex = interatorIndex.Current;
                Index index = new Index(navigatorIndex);
                tableGroupIndexes.Groups.Add(index);
                
                // Add Field Index
                XPathNodeIterator interatorIndexField = navigatorIndex.Select("Fields/FieldArray/Field");
                while (interatorIndexField.MoveNext()) {
                    XPathNavigator navigatorIndexField = interatorIndexField.Current;

                    IndexField indexField = new IndexField(navigatorIndexField);
                    index.Rows.Add(indexField);
                }
            }
        }
Beispiel #18
0
		private float GetRowsHeight(TableGroup parent)
		{
			float height = 0;

			//Add top level rows
			foreach (TableRow row in parent.Rows)
			{
				height += RowHeight;
			}

			return height;
		}
Beispiel #19
0
		private float GetGroupHeight(TableGroup parent)
		{
			float height = 0;

			height += GroupHeight;
			
			if (parent.Expanded) 
			{
				//Add sub groups
				foreach (TableGroup subgroup in parent.Groups)
				{
					height += GetGroupHeight(subgroup);
				}

				//Add sub rows
				height += GetRowsHeight(parent);
			}

			return height;
		}
Beispiel #20
0
		private bool GetRowsHeight(TableItem check, TableGroup parent, ref float height)
		{
			//Add top level rows
			foreach (TableRow row in parent.Rows)
			{
				if (row == check) return true;
				height += RowHeight;
			}

			return false;
		}
Beispiel #21
0
		private bool GetGroupHeight(TableItem check, TableGroup parent, ref float height)
		{
			height += GroupHeight;
			
			if (parent.Expanded) 
			{
				//Add sub groups
				foreach (TableGroup subgroup in parent.Groups)
				{
					if (subgroup == check) return true;
					if (GetGroupHeight(check, subgroup, ref height)) return true;
				}

				//Add sub rows
				if (GetRowsHeight(check, parent, ref height)) return true;
			}

			return false;
		}