Beispiel #1
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);
        }
Beispiel #2
0
        public void PolygonHotSpot_AssignToDefaultProperties()
        {
            PolygonHotSpot polygon = new PolygonHotSpot();

            polygon.Coordinates = string.Empty;
            Assert.AreEqual(string.Empty, polygon.Coordinates, "Coordinates");
        }
Beispiel #3
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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ImageMap1.ImageUrl      = @"~/Images/chart.png";
            ImageMap1.AlternateText = "This is chart";
            ImageMap1.HotSpotMode   = HotSpotMode.PostBack;
            CircleHotSpot chs = new CircleHotSpot();

            chs.X             = 75;
            chs.Y             = 75;
            chs.Radius        = 6;
            chs.PostBackValue = "Circle HotSpot";
            ImageMap1.HotSpots.Add(chs);

            RectangleHotSpot rhs = new RectangleHotSpot();

            rhs.Top           = 101;
            rhs.Bottom        = 110;
            rhs.Left          = 74;
            rhs.Right         = 110;
            rhs.PostBackValue = "RectangleHotSpot";
            ImageMap1.HotSpots.Add(rhs);

            PolygonHotSpot phs = new PolygonHotSpot();

            phs.Coordinates   = "76,57,82,64,81,76,76,82,71,76,70,63";
            phs.PostBackValue = "PolygonHotSpot";
            ImageMap1.HotSpots.Add(phs);
        }
Beispiel #5
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", GridDevice.SelectedValue.ToString());
            ImageFilesObjectDataSource.InsertParameters.Add("NameUrlTable", "Device");
            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();
        }
Beispiel #6
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\" style=\"border-width:0px;\" /><map name=\"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>";

            HtmlDiff.AssertAreEqual(imageMap.Render(), originalHtml, "RenderNavigateShapesTextAssigned");
        }
Beispiel #7
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");
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MapPage.Visible       = true;
            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 (TempGrid.DataKeys[i].Values[4].ToString() == "True")
                {
                    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    = true;
            // для заполения ссылок и их названий
            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.Visible = false;
            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();
                Ph.PostBackValue = HotSpotsGrid.DataKeys[i].Values[4].ToString();
                MapPage.HotSpots.Add(Ph);
            }
        }
Beispiel #9
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();
 }
Beispiel #10
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");
        }
        protected override void OnClick(ImageMapEventArgs e)
        {
            string[] args = e.PostBackValue.Split(':');
            CurrentDepth     = Convert.ToInt32(args[0]);
            CurrentCounty    = String.Empty;
            CurrentCommunity = String.Empty;

            if (CurrentDepth == 0)
            {
                ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "HotSpotMapNorway.Fylker.jpg");
                loadCountiesHotSpots();
            }
            else if (CurrentDepth == 1)
            {
                CurrentCounty = args[1];
                ImageUrl      = Page.ClientScript.GetWebResourceUrl(this.GetType(), "HotSpotMapNorway." + CurrentCounty + ".jpg");
                loadCountyHotSpots();

                // The back hotspot
                PolygonHotSpot phs = new PolygonHotSpot();
                phs.PostBackValue = "0";
                phs.Coordinates   = "0,0 20,0 20,20 0,20";
                HotSpots.Add(phs);
            }
            else
            {
                CurrentCounty    = args[1];
                CurrentCommunity = args[2];

                ImageUrl = Page.ClientScript.GetWebResourceUrl(this.GetType(), "HotSpotMapNorway." + CurrentCounty + ".jpg");
                loadCountyHotSpots();

                // The back hotspot
                PolygonHotSpot phs = new PolygonHotSpot();
                phs.PostBackValue = "1:" + CurrentCounty;
                phs.Coordinates   = "0,0 20,0 20,20 0,20";
                HotSpots.Add(phs);
            }

            base.OnClick(e);
        }
        protected void loadCountiesHotSpots()
        {
            HotSpots.Clear();

            string hotSpotsXml = Page.ClientScript.GetWebResourceUrl(this.GetType(), "HotSpotMapNorway.HotSpots.xml");

            hotSpotsXml = GetAbsolutePath(hotSpotsXml);

            XmlDocument hotSpots = new XmlDocument();

            hotSpots.Load(hotSpotsXml);

            XmlNodeList nodes = hotSpots.SelectNodes("//county");

            foreach (XmlElement node in nodes)
            {
                PolygonHotSpot phs = new PolygonHotSpot();
                phs.PostBackValue = "1:" + node.GetAttribute("name");
                phs.Coordinates   = node.FirstChild.InnerText;
                HotSpots.Add(phs);
            }
        }
Beispiel #13
0
        public void PolygonHotSpot_ToString()
        {
            PolygonHotSpot polygon = new PolygonHotSpot();

            Assert.AreEqual("PolygonHotSpot", polygon.ToString(), "After-ToString");
        }
Beispiel #14
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;
                }
            }
        }