Example #1
0
        protected void DelCoordinate_Click(Object sender, EventArgs e)
        {
            ChangeMap.Visible = false;

             ImageFilesObjectDataSource.InsertMethod = "AddFileCoordinate";
             ImageFilesObjectDataSource.InsertParameters.Clear();
             ImageFilesObjectDataSource.InsertParameters.Add("Coordinate", Coordin.Text);

             ImageFilesObjectDataSource.InsertParameters.Add("ID_Files", TempGrid.DataKeys[0].Values[1].ToString());

             ImageFilesObjectDataSource.InsertParameters.Add("AlternateText", MapText.Text.ToString());
             ImageFilesObjectDataSource.InsertParameters.Add("ID_UrlTable", MachineGridView.SelectedValue.ToString());
             ImageFilesObjectDataSource.InsertParameters.Add("NameUrlTable", "Machine");
             ImageFilesObjectDataSource.Insert();
             ImageChildren.DataBind();
             ImgMapOne.HotSpots.Clear();
             for (int i = 0; i < ImageChildren.Rows.Count; i++)
             {
                 PolygonHotSpot Ph = new PolygonHotSpot();
                 Ph.AlternateText = ImageChildren.DataKeys[i].Values[3].ToString();
                 Ph.Coordinates = ImageChildren.DataKeys[i].Values[2].ToString();
                 ImgMapOne.HotSpots.Add(Ph);
             }
             Coordin.Text = "";
             ChangeMap.Checked = false;
             ImgButOne.Visible = false;
             ImgMapOne.Visible = true;
             UnitMap.Visible = false;
             ModalImageMaping.Show();
        }
Example #2
0
 public void PolygonHotSpot_GetCoordinates()
  {
     PolygonHotSpot polygon = new PolygonHotSpot();
     polygon.Coordinates = "10,20,30,40,50,60,70,80";
     Assert.AreEqual("10,20,30,40,50,60,70,80", polygon.Coordinates, "BeforeGetCoordinates");
     Assert.AreEqual("10,20,30,40,50,60,70,80", polygon.GetCoordinates(), "AfterGetCoordinates");
 }
Example #3
0
        public void Url_Map(string ID_Table, string Name_Table)
        {
            MapPage.Visible = true;
            ObjectDataTempGrig.SelectParameters.Clear();
            ObjectDataTempGrig.SelectParameters.Add("NameTable", Name_Table.ToString());
            ObjectDataTempGrig.SelectParameters.Add("ID_Table", ID_Table.ToString());
            TempGrid.DataSourceID = "ObjectDataTempGrig";
            TempGrid.DataKeyNames = new string[] { "ID_Table", "ID_Files", "fileName", "fileType", "MapMain" };
            TempGrid.DataBind();
            for (int i = 0; i < TempGrid.Rows.Count; i++)
            {
                FileCoordimateDataSource.SelectParameters.Clear();
                FileCoordimateDataSource.SelectParameters.Add("ID_files", TempGrid.DataKeys[i].Values[1].ToString());
            }
            string photoFilePath = Server.MapPath("../Image_Data/");
            for (int i = 0; i < TempGrid.Rows.Count; i++)
            {
                    if (!File.Exists(photoFilePath + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString()))
                    {
                        ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes";
                        ImageFilesObjectDataSource.SelectParameters.Clear();
                        ImageFilesObjectDataSource.SelectParameters.Add("documentID", TempGrid.DataKeys[i].Values[1].ToString());
                        ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath);
                        ImageFilesObjectDataSource.Select();
                    }
                    MapPage.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString();
                    break;
            }
            //поле для HotSpotsGrid
            BoundField PageImageGrid = new BoundField();
            PageImageGrid.HeaderText = "Связанные элементы";
            PageImageGrid.DataField = "AlternateText";
            PageImageGrid.Visible = false;
            // для заполения ссылок и их названий
            GridView HotSpotsGrid = new GridView();
            HotSpotsGrid.DataSourceID = "FileCoordimateDataSource";
            HotSpotsGrid.AutoGenerateColumns = false;
            HotSpotsGrid.DataKeyNames = new string[] { "ID", "ID_files", "Coordinate", "AlternateText", "ID_UrlTable" };
            HotSpotsGrid.Columns.Add(PageImageGrid);
            HotSpotsGrid.Width = 40;
            DivRightPage.Controls.Add(HotSpotsGrid);

            HotSpotsGrid.DataBind();
            MapPage.HotSpots.Clear();
            for (int i = 0; i < HotSpotsGrid.Rows.Count; i++)
            {
                PolygonHotSpot Ph = new PolygonHotSpot();
                Ph.AlternateText = HotSpotsGrid.DataKeys[i].Values[3].ToString();
                Ph.Coordinates = HotSpotsGrid.DataKeys[i].Values[2].ToString();
                Ph.PostBackValue = HotSpotsGrid.DataKeys[i].Values[4].ToString();
                MapPage.HotSpots.Add(Ph);
            }
        }
Example #4
0
        private void Load_Image()
        {
            string photoFilePath = Server.MapPath("../Image_Data/");
            LWImage.DataBind();
            MapPage.Visible = false;
            for (int i = 0; i < LWImage.Rows.Count; i++)
            {
                if (!File.Exists(photoFilePath + LWImage.DataKeys[i].Values[2].ToString() + "_" + LWImage.DataKeys[i].Values[1].ToString() + "." + LWImage.DataKeys[i].Values[3].ToString()))
                {
                    ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes";
                    ImageFilesObjectDataSource.SelectParameters.Clear();
                    ImageFilesObjectDataSource.SelectParameters.Add("documentID", LWImage.DataKeys[i].Values[1].ToString());
                    ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath);
                    ImageFilesObjectDataSource.Select();
                }
                MapPage.Visible = true;
                FileCoordimateDataSource.SelectParameters.Clear();
                FileCoordimateDataSource.SelectParameters.Add("ID_files", LWImage.DataKeys[0].Values[1].ToString());
                MapPage.ImageUrl = "~/Image_Data/" + LWImage.DataKeys[0].Values[2].ToString() + "_" + LWImage.DataKeys[0].Values[1].ToString() + "." + LWImage.DataKeys[0].Values[3].ToString();
            }
            MapPage.HotSpots.Clear();

            ImageChildren.DataBind();
            ImgMapOne.HotSpots.Clear();
            for (int i = 0; i < ImageChildren.Rows.Count; i++)
            {
                PolygonHotSpot Ph = new PolygonHotSpot();
                Ph.AlternateText = ImageChildren.DataKeys[i].Values[3].ToString();
                Ph.Coordinates = ImageChildren.DataKeys[i].Values[2].ToString();
                MapPage.HotSpots.Add(Ph);
            }
        }
Example #5
0
 // работа с картинками
 protected void LWImage_SelectedIndexChanged(Object sender, EventArgs e)
 {
     ImgButOne.ImageUrl = "~/Image_Data/" + LWImage.DataKeys[LWImage.SelectedIndex].Values[2].ToString() + "_" + LWImage.DataKeys[LWImage.SelectedIndex].Values[1].ToString() + "." + LWImage.DataKeys[LWImage.SelectedIndex].Values[3].ToString();
     ImgMapOne.ImageUrl = "~/Image_Data/" + LWImage.DataKeys[LWImage.SelectedIndex].Values[2].ToString() + "_" + LWImage.DataKeys[LWImage.SelectedIndex].Values[1].ToString() + "." + LWImage.DataKeys[LWImage.SelectedIndex].Values[3].ToString();
     ImageChildren.DataBind();
     ImgMapOne.HotSpots.Clear();
     for (int i = 0; i < ImageChildren.Rows.Count; i++)
     {
         PolygonHotSpot Ph = new PolygonHotSpot();
         Ph.AlternateText = ImageChildren.DataKeys[i].Values[3].ToString();
         Ph.Coordinates = ImageChildren.DataKeys[i].Values[2].ToString();
         ImgMapOne.HotSpots.Add(Ph);
     }
     ModalImageMaping.Show();
 }
Example #6
0
		public static void myPageLoad (Page page)
		{
			WebTest.CurrentTest.UserData = "Init";
			ImageMap imgmap = new ImageMap ();
			imgmap.ID = "imgmap";
			imgmap.HotSpotMode = HotSpotMode.NotSet;
			imgmap.Click += new ImageMapEventHandler (ImageMapClickHandler2);
			RectangleHotSpot rect = new RectangleHotSpot ();
			rect.HotSpotMode = HotSpotMode.PostBack;
			rect.PostBackValue = "Rectangle";
			imgmap.HotSpots.Add (rect);
			PolygonHotSpot poly = new PolygonHotSpot ();
			poly.HotSpotMode = HotSpotMode.PostBack;
			poly.PostBackValue = "Polygon";
			imgmap.HotSpots.Add (poly);
			imgmap.HotSpotMode = HotSpotMode.PostBack;
			CircleHotSpot circle = new CircleHotSpot ();
			circle.PostBackValue = "Circle";
			imgmap.HotSpots.Add (circle);
			// Two marks for getting controls from form
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (imgmap);
			page.Form.Controls.Add (lce);
		}
Example #7
0
		public void ImageMap_EventPolygon ()
		{
			PokerImageMap imageMap = new PokerImageMap ();
			ResetEvents ();
			imageMap.HotSpotMode = HotSpotMode.NotSet;
			PolygonHotSpot poly = new PolygonHotSpot ();
			poly.HotSpotMode = HotSpotMode.PostBack;
			poly.PostBackValue = "myPoly";
			imageMap.HotSpots.Add (poly);
			imageMap.Click += new ImageMapEventHandler (ImageMapClickHandler);
			Assert.AreEqual ("Init", pbValue, "BeforeClick");
			imageMap.DoOnClick (new ImageMapEventArgs (poly.PostBackValue));
			Assert.AreEqual ("myPoly", pbValue, "AfterClick");
		}
Example #8
0
		public void ImageMap_AssignedValues_RenderNavigateShapes ()
		{
			// Rectangle/Polygon.HotSpotMode = Navigate 
			//-----------------------------------------
			PokerImageMap imageMap = new PokerImageMap ();
			imageMap.Enabled = true;
			imageMap.HotSpotMode = HotSpotMode.NotSet;
			RectangleHotSpot rect = new RectangleHotSpot ();
			rect.AccessKey = "R";
			rect.AlternateText = "Rectangle";
			rect.HotSpotMode = HotSpotMode.Navigate;
			rect.NavigateUrl = "NavigateUrlRect";
			rect.TabIndex = 1;
			rect.Bottom = 10;
			rect.Top = 20;
			rect.Left = 30;
			rect.Right = 40;
			imageMap.HotSpots.Add (rect);
			imageMap.HotSpotMode = HotSpotMode.Navigate;
			PolygonHotSpot poly = new PolygonHotSpot ();
			poly.AccessKey = "P";
			poly.AlternateText = "Polygon";
			poly.NavigateUrl = "NavigateUrlPoly";
			poly.TabIndex = 2;
			poly.Coordinates = "10,20,30,40,50,60,100,200";
			imageMap.HotSpots.Add (poly);
			string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"rect\" coords=\"30,20,40,10\" href=\"NavigateUrlRect\" title=\"Rectangle\" alt=\"Rectangle\" accesskey=\"R\" tabindex=\"1\" /><area shape=\"poly\" coords=\"10,20,30,40,50,60,100,200\" href=\"NavigateUrlPoly\" title=\"Polygon\" alt=\"Polygon\" accesskey=\"P\" tabindex=\"2\" />\r\n</map>";
			string renderedHtml = imageMap.Render ();
			HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "RenderNavigateShapesTextAssigned");
		}
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Msg.Text = "";
            Coordinats = new TextBox();
            UpdateButton.Visible = false;
            InsertButton.Visible = true;
            DeleteButton.Visible = false;

            MapPage.Visible = true;

            if (!Page.IsPostBack)
            {
                string photoFilePath = Server.MapPath("../Image_Data/");
                for (int j = 0; j < BuildingGridView.Rows.Count; j++)
                {
                    if (BuildingGridView.DataKeys[j].Values[1].ToString() == "True")
                    {
                        ObjectDataTempGrig.SelectParameters.Clear();
                        ObjectDataTempGrig.SelectParameters.Add("NameTable", "Building");
                        ObjectDataTempGrig.SelectParameters.Add("ID_Table", BuildingGridView.DataKeys[j].Values[0].ToString());
                        break;
                    }
                }
                TempGrid.DataSourceID = "ObjectDataTempGrig";
                TempGrid.DataKeyNames = new string[] { "ID_Table", "ID_Files", "fileName", "fileType", "MapMain" };
                TempGrid.DataBind();

                BoundField PageImageGrid = new BoundField();
                PageImageGrid.HeaderText = "Связанные элементы";
                PageImageGrid.DataField = "AlternateText";
                PageImageGrid.Visible = false;

                GridView HotSpotsGrid = new GridView();
                HotSpotsGrid.DataSourceID = "FileCoordimateDataSource";
                HotSpotsGrid.AutoGenerateColumns = false;
                HotSpotsGrid.DataKeyNames = new string[] { "ID", "ID_files", "Coordinate", "AlternateText" };
                HotSpotsGrid.Columns.Add(PageImageGrid);
                HotSpotsGrid.Width = 40;
                DivRightPage.Controls.Add(HotSpotsGrid);

                HotSpotsGrid.DataBind();

                for (int i = 0; i < HotSpotsGrid.Rows.Count; i++)
                {
                    PolygonHotSpot Ph = new PolygonHotSpot();
                    Ph.AlternateText = HotSpotsGrid.DataKeys[i].Values[3].ToString();
                    Ph.Coordinates = HotSpotsGrid.DataKeys[i].Values[2].ToString();
                    MapPage.HotSpots.Add(Ph);
                }

                for (int i = 0; i < TempGrid.Rows.Count; i++)
                {
                    if (!File.Exists(photoFilePath + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString()))
                    {
                        ImageFilesObjectDataSource.SelectMethod = "TestGetSqlBytes";
                        ImageFilesObjectDataSource.SelectParameters.Clear();
                        ImageFilesObjectDataSource.SelectParameters.Add("documentID", TempGrid.DataKeys[i].Values[1].ToString());
                        ImageFilesObjectDataSource.SelectParameters.Add("filePath", photoFilePath);
                        ImageFilesObjectDataSource.Select();
                    }
                    MapPage.ImageUrl = "~/Image_Data/" + TempGrid.DataKeys[i].Values[2].ToString() + "_" + TempGrid.DataKeys[i].Values[1].ToString() + "." + TempGrid.DataKeys[i].Values[3].ToString();
                    break;
                }

            }
        }
Example #10
0
 public void PolygonHotSpot_ToString()
 {
     PolygonHotSpot polygon = new PolygonHotSpot();
     Assert.AreEqual("PolygonHotSpot", polygon.ToString(), "After-ToString");
 }
Example #11
0
 public void PolygonHotSpot_AssignToDefaultProperties()
 {
     PolygonHotSpot polygon = new PolygonHotSpot();
     polygon.Coordinates = string.Empty;
     Assert.AreEqual(string.Empty, polygon.Coordinates, "Coordinates");
 }