Пример #1
0
		// Updates restrictions info 
		private void UpdateInfo()
		{
			int nCount = m_arrRestrictions.Count;
			for (int i = 0; i < nCount; i++)
			{
				RestrictControl ctrlRestriction = null;
				ctrlRestriction = m_pnlRestrictions.Controls[nCount - 1 - i] as RestrictControl;

				RestrictionsInfo objRestriction = m_arrRestrictions[i] as RestrictionsInfo;
				objRestriction.m_strName = ctrlRestriction.RSName;
				objRestriction.m_bChecked = ctrlRestriction.RSChecked;
				objRestriction.m_eType = ctrlRestriction.RSType;

				if (objRestriction.m_bUseParameter)
					objRestriction.m_dParameter = ctrlRestriction.RSParameter;
			}
		}
Пример #2
0
        // Receives restriction from route and inits controls 
		public void Init(ISMRouter objRouter)
		{
			// clear controls
			ClearAll();

			try
			{
				this.SuspendLayout();
				m_pnlRestrictions.SuspendLayout();

				// Get Net attributes
				ISMNetAttributesCollection objAttrColl = null;
				objAttrColl = objRouter.NetAttributes;

				// attributes count
				int nCount = objAttrColl.Count;

				for (int i = 0; i < nCount; i++)
				{
					// get attribute
					SMNetAttribute objAttr = null;
					objAttr = objAttrColl.get_Item(i);

					if ((objAttr) is ISMNetAttribute2)
					{
						ISMNetAttribute2 objAttr2 = null;
						objAttr2 = objAttr as ISMNetAttribute2;

						// If Usage type is restriction
						esriSMNetAttributeUsageType eType = 0;
						eType = objAttr2.UsageType;

						if (eType == esriSMNetAttributeUsageType.esriSMNAUTRestrictionBoolean 
							|| eType == esriSMNetAttributeUsageType.esriSMNAUTRestrictionMinAllowed 
							|| eType == esriSMNetAttributeUsageType.esriSMNAUTRestrictionMaxAllowed)
						{

							// create control for restriction
							RestrictControl ctrlRestriction = null;
							ctrlRestriction = new RestrictControl();

							// create restriction info
							RestrictionsInfo objRestriction = null;
							objRestriction = new RestrictionsInfo();

							// Init info
							objRestriction.m_objAttr2 = objAttr2;
							objRestriction.m_strName = objAttr2.Name;
							objRestriction.m_bChecked = false;
							objRestriction.m_eType = RestrictControl.ERSType.eStrict;
							objRestriction.m_bUseParameter = false;

							if (eType != esriSMNetAttributeUsageType.esriSMNAUTRestrictionBoolean)
							{
								objRestriction.m_bUseParameter = true;
								objRestriction.m_dParameter = 0.0;
							}

							// Add controls (reverse order)
							ctrlRestriction.Dock = DockStyle.Top;
							m_pnlRestrictions.Controls.Add(ctrlRestriction);

							m_arrRestrictions.Add(objRestriction);
						}
					}
				}

				// Set restriction info to controls
				UpdateControls();

			}
			catch (Exception ex)
			{
				ClearAll();
			}
			finally
			{
				m_pnlRestrictions.ResumeLayout(false);
				this.ResumeLayout(false);
			}
		}