Esempio n. 1
0
        private void NavigateToButton_Click(object sender, EventArgs e)
        {
            if (cbCity.SelectedIndex == -1)
            {
                return;
            }

            // Find the map point label corresponding to the selected city
            NLayer          citiesLayer    = (NLayer)document.Layers.GetChildByName("cities");
            NMapLabelsShape mapLabelsShape = (NMapLabelsShape)citiesLayer.GetChildAt(0);
            NMapPointLabel  pointLabel     = (NMapPointLabel)mapLabelsShape.MapLabels.GetChildByName(cbCity.Text);

            if (pointLabel == null)
            {
                return;
            }

            view.Zoom(2.0f, pointLabel.PinPoint, true);
            if (m_ZoomedCity != null)
            {
                m_ZoomedCity.StyleSheetName = String.Empty;
            }

            pointLabel.StyleSheetName = "Zoomed City";
            m_ZoomedCity = pointLabel;
        }
Esempio n. 2
0
            void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;
                NDrawingDocument    document       = diagramControl.Document;

                string[] args     = argument.Split(',');
                string   cityName = args[0];
                float    x        = Single.Parse(args[1], CultureInfo.InvariantCulture);
                float    y        = Single.Parse(args[2], CultureInfo.InvariantCulture);

                if (document.Tag is NPointElement)
                {
                    ((NPointElement)document.Tag).StyleSheetName = String.Empty;
                    document.Tag = null;
                }

                NLayer cityLayer = diagramControl.Document.Layers.GetChildByName("cities") as NLayer;

                if (cityLayer != null)
                {
                    // Apply the new style to the newly zoomed city
                    NMapLabelsShape labelsShape = (NMapLabelsShape)cityLayer.GetChildAt(0);
                    NMapPointLabel  city        = (NMapPointLabel)labelsShape.MapLabels.GetChildByName(cityName);
                    city.StyleSheetName = "ZoomedCity";

                    // Remember the currently highlighted city in the document's tag
                    document.Tag = city;
                }

                diagramControl.View.Layout = CanvasLayout.Normal;
                diagramControl.Zoom(2, new NPointF(x, y));
            }