コード例 #1
0
		// Fills text box
		public void Init(ISMDirections objDirections)
		{
			int nCount = objDirections.Count;

			string strText = null;

			// Totals
			strText = objDirections.TotalsText + System.Environment.NewLine + System.Environment.NewLine;

			// Add text for each Direction
			for (int i = 0; i < nCount; i++)
			{
				SMDirItem objItem = null;
				objItem = objDirections.get_Item(i);

				// Direction text
				strText = strText + objItem.Text + System.Environment.NewLine;

				// Drive text (length, time)
				if (objItem.DriveText.Length > 0)
						strText = strText + "    " + objItem.DriveText + System.Environment.NewLine;

				strText = strText + System.Environment.NewLine;
			}

			// Set control text
			m_txtDirections.Text = strText;

			// deselect if was be selected
			m_txtDirections.Select(0, 0);
		}
コード例 #2
0
		// Fills text box
		public void Init(ISMDirections objDirections)
		{
			int nCount = objDirections.Count;

			string strText = null;

			// Totals
			strText = objDirections.TotalsText + System.Environment.NewLine + System.Environment.NewLine;

			// Add text for each Direction
			for (int i = 0; i < nCount; i++)
			{
				SMDirItem objItem = null;
				objItem = objDirections.get_Item(i);

				// Direction text
				strText = strText + objItem.Text + System.Environment.NewLine;

				// Drive text (length, time)
				if (objItem.DriveText.Length > 0)
						strText = strText + "    " + objItem.DriveText + System.Environment.NewLine;

				strText = strText + System.Environment.NewLine;
			}

			// Set control text
			m_txtDirections.Text = strText;

			// deselect if was be selected
			m_txtDirections.Select(0, 0);
		}
コード例 #3
0
		// Adds Directions points to point collection
		private void AddPointsToPolyline(ISMDirections objDirections, ref IPointCollection objPoints)
		{

			Point objPoint = new PointClass();

			// copy points from DD to line
			int nItemsCount = objDirections.Count;
			for (int i = 0; i < nItemsCount; i++)
			{
				// get shape from Direction
				ISMDirItem objItem = null;
				objItem = objDirections.get_Item(i) as ISMDirItem;

				ISMPointsCollection objShape = null;
				objShape = objItem.Shape;

                // Add point from Direction to received collection
				int nPointsCount = objShape.Count - 1;
				for (int j = 0; j <= nPointsCount; j++)
				{
					// get point from route
					SMRouterPoint objRouterPoint = objShape.get_Item(j);

                    // Optimization: Not add point if last added point has similar coords
					bool bAddPoint = false;

					if (objPoint.IsEmpty)
						bAddPoint = true;
					else if ((objPoint.X != objRouterPoint.X) & (objPoint.Y != objRouterPoint.Y))
						bAddPoint = true;

					if (bAddPoint)
					{
						// Add point if need
						objPoint.X = objRouterPoint.X;
						objPoint.Y = objRouterPoint.Y;
						objPoint.SpatialReference = m_objSpatialReference;

						object missing = System.Reflection.Missing.Value;
						objPoints.AddPoint(objPoint, ref missing, ref missing);
					}
				}
			}
		}