void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, NRequestContext context, string argument)
            {
                NThinDiagramControl diagramControl = (NThinDiagramControl)control;

                string[]      args         = argument.Split(',');
                NDataGrouping dataGrouping = null;

                switch (args[0])
                {
                case "EqualDistribution":
                    dataGrouping = new NDataGroupingEqualDistribution();
                    break;

                case "EqualInterval":
                    dataGrouping = new NDataGroupingEqualInterval();
                    break;

                case "Optimal":
                    dataGrouping = new NDataGroupingOptimal();
                    break;

                default:
                    throw new Exception("New data grouping type?");
                }

                dataGrouping.RoundedRanges = Boolean.Parse(args[1]);

                MapRenderer mapRenderer = new MapRenderer();

                mapRenderer.InitDocument(diagramControl.Document, dataGrouping);

                diagramControl.UpdateView();
                diagramControl.AddCustomClientCommand("UpdateLegend");
            }
Пример #2
0
        public NMapDataBindingUC(NMainForm form)
            : base(form)
        {
            m_DataGrouping = new NDataGroupingOptimal();
            m_DataGrouping.RoundedRanges = true;

            InitializeComponent();
        }
Пример #3
0
        public NWorldPopulationUC(NMainForm form)
            : base(form)
        {
            m_DataGrouping = new NDataGroupingOptimal();
            m_DataGrouping.RoundedRanges = true;

            InitializeComponent();
        }
Пример #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (NThinDiagramControl1.Initialized)
            {
                return;
            }

            // Init the diagram control
            NThinDiagramControl1.CustomRequestCallback = new CustomRequestCallback();

            // Set manual ID so that it can be referenced in JavaScript
            NThinDiagramControl1.StateId = "Diagram1";

            // Init the view
            NThinDiagramControl1.View.MinZoomFactor = 0.1f;
            NThinDiagramControl1.View.MaxZoomFactor = 50;
            NThinDiagramControl1.View.Layout        = CanvasLayout.Fit;

            // Configure the controller
            NThinDiagramControl1.Controller.Tools.Add(new NTooltipTool());
            NThinDiagramControl1.Controller.Tools.Add(new NCursorTool());
            NThinDiagramControl1.Controller.Tools.Add(new NRectZoomTool());
            NPanTool panTool = new NPanTool();

            panTool.Enabled = false;
            NThinDiagramControl1.Controller.Tools.Add(panTool);

            // Configure the toolbar
            NThinDiagramControl1.Toolbar.Visible = true;
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NZoomInAction()));
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NZoomOutAction()));
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator());

            Array values = Enum.GetValues(typeof(CanvasLayout));

            for (int i = 0; i < values.Length; i++)
            {
                NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleViewLayoutAction((CanvasLayout)values.GetValue(i))));
            }

            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator());
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NTogglePanToolAction()));
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleRectZoomToolAction()));

            // Create the default data grouping
            NDataGrouping dataGrouping = new NDataGroupingOptimal();

            dataGrouping.RoundedRanges = true;

            // Init the document
            NDrawingDocument document = NThinDiagramControl1.Document;

            document.BeginInit();
            MapRenderer mapRenderer = new MapRenderer();

            mapRenderer.InitDocument(document, dataGrouping);
            document.EndInit();
        }
Пример #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (NThinDiagramControl1.Initialized)
            {
                return;
            }

            // Init the diagram control
            MapRenderer mapRenderer = new MapRenderer();

            // Configure the controller
            NServerMouseEventTool serverMouseEventTool = new NServerMouseEventTool();

            NThinDiagramControl1.Controller.Tools.Add(serverMouseEventTool);
            serverMouseEventTool.MouseDown = new NMouseDownEventCallback(mapRenderer);

            // Init the view
            NThinDiagramControl1.View.MinZoomFactor = 0.1f;
            NThinDiagramControl1.View.MaxZoomFactor = 50;
            NThinDiagramControl1.View.Layout        = CanvasLayout.Fit;

            // Configure the controller
            NThinDiagramControl1.Controller.Tools.Add(new NTooltipTool());
            NThinDiagramControl1.Controller.Tools.Add(new NCursorTool());

            // Configure the toolbar
            NThinDiagramControl1.Toolbar.Visible = true;
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NZoomInAction()));
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NZoomOutAction()));
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator());

            Array values = Enum.GetValues(typeof(CanvasLayout));

            for (int i = 0; i < values.Length; i++)
            {
                NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleViewLayoutAction((CanvasLayout)values.GetValue(i))));
            }

            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarSeparator());
            NThinDiagramControl1.Toolbar.Items.Add(new NToolbarButton(new NToggleTooltipToolAction()));

            // Init the document
            NDrawingDocument document = NThinDiagramControl1.Document;

            document.BeginInit();
            NDataGrouping dataGrouping = new NDataGroupingOptimal();

            dataGrouping.RoundedRanges = true;
            mapRenderer.InitDocument(document);
            document.EndInit();
        }
Пример #6
0
        private void btnRecreateMap_Click(object sender, EventArgs e)
        {
            if (rbEqualDistribution.Checked)
            {
                m_DataGrouping = new NDataGroupingEqualDistribution();
            }
            else if (rbEqualInterval.Checked)
            {
                m_DataGrouping = new NDataGroupingEqualInterval();
            }
            else
            {
                m_DataGrouping = new NDataGroupingOptimal();
            }

            m_DataGrouping.RoundedRanges = chkRoundedRanges.Checked;
            ResetExample();
        }
            public NDrawingDocument Deserialize(NThinDiagramControl control)
            {
                if (m_Document == null)
                {
                    // Create the default data grouping
                    NDataGrouping dataGrouping = new NDataGroupingOptimal();
                    dataGrouping.RoundedRanges = true;

                    // Init the document
                    m_Document = new NDrawingDocument();
                    m_Document.BeginInit();
                    MapRenderer mapRenderer = new MapRenderer();
                    mapRenderer.InitDocument(m_Document, dataGrouping);
                    m_Document.EndInit();
                }

                return(m_Document);
            }