Exemple #1
0
    //
    // Unity Methods
    //

    private IEnumerator Start()
    {
        // Avoid updates while loading
        nextUpdate = int.MaxValue;

        Loader.Create(LoadCitations(), true);

        yield return(WaitFor.Frames(WaitFor.InitialFrames));

        inputHandler = ComponentManager.Instance.Get <InputHandler>();
        map          = ComponentManager.Instance.Get <MapController>();
        var mapViewArea = ComponentManager.Instance.Get <MapViewArea>();

        if (mapViewArea != null)
        {
            mapViewTransform = mapViewArea.transform as RectTransform;
        }

        dataLayers = ComponentManager.Instance.Get <DataLayers>();
        dataLayers.OnLayerVisibilityChange += OnDataLayerVisibilityChange;

        resolution = Instantiate(layerEntryPrefab, container, false);
        resolution.Init("Resolution", Color.clear);

        nextUpdate = Time.time + updateInterval;
    }
Exemple #2
0
    public void ComputeCorrelations(DataLayers dataLayers)
    {
        var activeDataLayers = dataLayers.activeLayerPanels;
        var count            = activeDataLayers.Count;

        // For each data layer, loop runs for a total of totalCoeffs * N iterations
        for (int i = 0; i < count; ++i)
        {
            // Coeffs of same data layer will always be 1
            dataLayers.CorrCoeffs[i, i] = 1.0f;

            // Run against another demo
            for (int j = i + 1; j < count; ++j)
            {
                var taskInfo = new CorrelationTaskInfo(SpearmanCorrelation.CorrelationCalculationTask)
                {
                    dataLayers = dataLayers,
                    a          = i,
                    b          = j,
                };
#if USE_TASKS
                scheduler.Add(taskInfo);
#else
                taskInfo.task(taskInfo);
#endif
            }
        }

#if USE_TASKS
        // Start Scheduler
        scheduler.Run(this, null);
#endif
    }
Exemple #3
0
    //
    // Unity Methods
    //

    private IEnumerator Start()
    {
        dialogManager = FindObjectOfType <ModalDialogManager>();

        progressDialog = dialogManager.NewProgressDialog();
        progressDialog.SetMessage(Translator.Get("Loading") + " ...");
        progressDialog.SetProgress(0);

#if UNITY_WEBGL
        // Show welcome screen for online version
        dialogManager.ShowWebWelcomeMessage();
#endif

        yield return(WaitFor.Frames(WaitFor.InitialFrames - 1));            // -1 to initialize before all other components

        // Mandatory components
        var componentManager = ComponentManager.Instance;
        dataLayers       = componentManager.Get <DataLayers>();
        loadingComponent = componentManager.Get <LoadingComponent>();
        map = componentManager.Get <MapController>();

        dialogManager.UpdateUI();

        InitMapControllers();

        // Load config (groups & layers)
        StartCoroutine(Init());
    }
Exemple #4
0
        protected void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes();
            log4net.Config.XmlConfigurator.Configure();

            BuildManager.GetReferencedAssemblies(); // make sure assemblies are loaded even though methods may not have been called yet

            DataLayers dataLayers    = GetDataLayers();
            string     dataLayerPath = string.Empty;

            string path = ConfigurationManager.AppSettings["AppDataPath"];

            if (!string.IsNullOrEmpty(path))
            {
                if (!path.EndsWith("\\"))
                {
                    path += "\\";
                }

                if (!path.StartsWith(@"\\") && !path.Contains(@":\"))
                {
                    path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
                }
                dataLayerPath = path + "DataLayers.xml";
            }
            else
            {
                dataLayerPath = AppDomain.CurrentDomain.BaseDirectory + "\\App_Data\\DataLayers.xml";
            }
            Utility.Write <DataLayers>(dataLayers, dataLayerPath);
        }
Exemple #5
0
    private void OnRegistrationFinished()
    {
        mapViewArea  = ComponentManager.Instance.Get <MapViewArea>();
        inputHandler = ComponentManager.Instance.Get <InputHandler>();
        dataLayers   = ComponentManager.Instance.Get <DataLayers>();

        dataLayers.OnLayerAvailabilityChange += OnLayerAvailabilityChange;
    }
Exemple #6
0
    //
    // Inheritance Methods
    //

    protected override void OnComponentRegistrationFinished()
    {
        base.OnComponentRegistrationFinished();

        // Get Components
        dataLayers   = ComponentManager.Instance.Get <DataLayers>();
        inputHandler = ComponentManager.Instance.Get <InputHandler>();
    }
Exemple #7
0
    //
    // Inheritance Methods
    //

    protected override void OnComponentRegistrationFinished()
    {
        base.OnComponentRegistrationFinished();

        networkLayerName = "Network"; //-

        roads = new RoadInfo[maxRoadCount];
        for (int i = 0; i < maxRoadCount; i++)
        {
            var road = new RoadInfo
            {
                mapLayer  = null,
                uiElement = Instantiate(roadTogglePrefab, roadsList, false),
            };

            road.uiElement.toggle.onValueChanged.AddListener((isOn) => OnRoadToggleChanged(road, isOn));
            road.uiElement.button.onClick.AddListener(() => RemoveRoad(road));
            ResetRoadUI(road.uiElement);

            roads[i] = road;
        }

        // Get Components
        dataLayers  = ComponentManager.Instance.Get <DataLayers>();
        siteBrowser = ComponentManager.Instance.Get <SiteBrowser>();

        // UI Listeners - Main Panel
        layerDropdown.onValueChanged.AddListener(OnSelectedLayerChanged);
        startSingleButton.onValueChanged.AddListener(OnToggleStartSingle);
        startMultiButton.onValueChanged.AddListener(OnToggleStartMulti);
        clearButton.onClick.AddListener(OnClearClicked);
        showRoadsToggle.onValueChanged.AddListener(OnToggleShowRoads);
        showIsochronToggle.onValueChanged.AddListener(OnToggleShowIsochrons);
        showStartPtToggle.onValueChanged.AddListener(OnToggleShowStartPts);
        editSpeedToggle.onValueChanged.AddListener(OnEditSpeedToggleChanged);
        newRoadButton.onClick.AddListener(OnNewRoadClick);
#if !UNITY_WEBGL
        networkDisruptionAnalysisToggle.onValueChanged.AddListener(OnNetworkDisruptionAnalysisToggleChanged);
#endif
        traveTimeSlider.onValueChanged.AddListener(OnTravelTimeSliderChanged);

        // UI Listeners - New Road Panel
        finishNewRoadButton.onClick.AddListener(OnFinishNewRoadClick);
        highwayButton.onValueChanged.AddListener((isOn) => OnRoadClassificationChange(highwayButton));
        primaryButton.onValueChanged.AddListener((isOn) => OnRoadClassificationChange(primaryButton));
        secondaryButton.onValueChanged.AddListener((isOn) => OnRoadClassificationChange(secondaryButton));
        otherButton.onValueChanged.AddListener((isOn) => OnRoadClassificationChange(otherButton));
        createRoadToggle.onValueChanged.AddListener(OnCreateRoadChanged);
        removeRoadToggle.onValueChanged.AddListener(OnRemoveRoadChanged);

#if !UNITY_WEBGL
        // Initialize notification title and message
        NDAAnalysisCompletedNotification.Init("Network Data Analysis", "Analysis Completed!");
        NDASetupCompletedNotification.Init("Network Data Analysis", "Setup Completed!");
#endif
    }
Exemple #8
0
    //
    // Unity Methods
    //

    private void Awake()
    {
        // Find Components
        map = ComponentManager.Instance.Get <MapController>();
        gridLayerController = map.GetLayerController <GridLayerController>();
        inputHandler        = ComponentManager.Instance.Get <InputHandler>();
        outputPanel         = ComponentManager.Instance.Get <OutputPanel>();
        dataLayers          = ComponentManager.Instance.Get <DataLayers>();
        mapViewArea         = ComponentManager.Instance.Get <MapViewArea>();
    }
Exemple #9
0
    public void UpdateAreaInspectorOutput(AreaInfo areaInfo, DataLayers dataLayers)
    {
        Dictionary <string, List <float> > idToValueList    = new Dictionary <string, List <float> >();
        Dictionary <string, int>           idToNoDataList   = new Dictionary <string, int>();
        Dictionary <string, string>        idToUnitsList    = new Dictionary <string, string>();
        Dictionary <string, Color>         idToDotColorList = new Dictionary <string, Color>();

        // Get information here

        SetData(idToValueList, idToUnitsList, idToDotColorList, idToNoDataList);
    }
        public ActionResult DataLayers()
        {
            DataLayers dataLayers = _repository.GetDataLayers();

            JsonContainer <DataLayers> container = new JsonContainer <DataLayers>();

            container.items   = dataLayers;
            container.success = true;
            container.total   = dataLayers.Count;

            return(Json(container, JsonRequestBehavior.AllowGet));
        }
Exemple #11
0
    //
    // Unity Methods
    //

    private void Awake()
    {
        // Components
        var componentManager = ComponentManager.Instance;

        inspectorTool       = componentManager.Get <InspectorTool>();
        contoursTool        = componentManager.Get <ContoursTool>();
        dataLayers          = componentManager.Get <DataLayers>();
        gridLayerController = inspectorTool.Map.GetLayerController <GridLayerController>();
        translator          = LocalizationManager.Instance;

        areaPSUIRef.Init(translator);
        contourPSUIRef.Init(translator);

        // Initialize dropdowns
        inspectorOutputDropdowns = new InspectorOutputDropdown[]
        {
            new InspectorOutputDropdown(areaTypeDropdown, AreaTypeOptions),
            new InspectorOutputDropdown(areaPSUIRef.summaryDropdown, PSO.AreaSummaryOptions),
            new InspectorOutputDropdown(areaPSUIRef.metricsDropdown, PSO.MetricsOptions),
        };
        InitDropdowns();

        // Initialize properties and summaries
        int maxInspectionCount = inspectorTool.maxInspectionCount;

        areaPS = new AreaPS[maxInspectionCount];
        for (int i = 0; i < maxInspectionCount; ++i)
        {
            areaPS[i] = new AreaPS();
        }
        contourPS = new ContourPS();

        // Initialize listeners
        gridLayerController.OnShowGrid += OnShowGrid;
        LocalizationManager.Instance.OnLanguageChanged += OnLanguageChanged;
        areaTypeDropdown.onValueChanged.AddListener(UpdatePropertiesAndSummariesPanel);
        areaPSUIRef.summaryDropdown.onValueChanged.AddListener(UpdateAreaPanel);
        areaPSUIRef.computeCorrelationButton.onClick.AddListener(OnComputeCorrelationClicked);

        // Update panels
        UpdatePropertiesAndSummariesPanel(Area);
        UpdateAreaPanel(AreaPS.SelectedArea);
        UpdateContourPanel();

        ResetAndClearOutput();

        // If contours tool is already open and there is a selected contour
        if (contoursTool != null && inspectorTool.InspectOutput != null)
        {
            inspectorTool.InspectOutput.AreaOutput.UpdateContourInspectorOutput(dataLayers);
        }
    }
    //
    // Inheritance Methods
    //

    protected override void OnComponentRegistrationFinished()
    {
        base.OnComponentRegistrationFinished();

        // Get Components
        dataLayers   = ComponentManager.Instance.Get <DataLayers>();
        inputHandler = ComponentManager.Instance.Get <InputHandler>();

        centerTopContainerT = GameObject.Find("CenterTopContainer").transform;
        LegendPanl          = centerTopContainerT.Find("Footer").Find("LegendPanel").GetComponent <LegendPanel>();

        // Initialize edit colour panel
        editColourPanel = Instantiate(editColourPanelPrefab, centerTopContainerT, false);
        editColourPanel.gameObject.SetActive(false);
    }
Exemple #13
0
    protected override void OnToggleTool(bool isOn)
    {
        if (isOn)
        {
            // Cache references
            dataManager = ComponentManager.Instance.Get <DataManager>();
            dataLayers  = ComponentManager.Instance.Get <DataLayers>();

            // Enable listeners
            dataLayers.OnLayerVisibilityChange += OnDataLayerVisibilityChange;
            slider.onValueChanged.AddListener(OnSliderChange);
            map.OnBoundsChange += OnMapBoundsUpdate;

            foreach (var group in dataManager.groups)
            {
                foreach (var layer in group.layers)
                {
                    if (dataLayers.IsLayerActive(layer))
                    {
                        activeLayers.Add(layer);
                        layer.OnPatchVisibilityChange += OnPatchVisibilityChange;
                    }
                }
            }

            CheckVisibleData();
        }
        else
        {
            // Disable listeners
            dataLayers.OnLayerVisibilityChange -= OnDataLayerVisibilityChange;
            slider.onValueChanged.RemoveAllListeners();
            map.OnBoundsChange -= OnMapBoundsUpdate;

            foreach (var layer in activeLayers)
            {
                layer.OnPatchVisibilityChange -= OnPatchVisibilityChange;
            }

            activeLayers.Clear();

            ResetLayersYear();

            selectedYear = -1;
        }
    }
        public DataLayers GetDataLayers()
        {
            DataLayers obj = null;

            try
            {
                WebHttpClient client = CreateWebClient(_adapterServiceUri);
                obj = client.Get <DataLayers>("/datalayers");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
                throw;
            }

            return(obj);
        }
Exemple #15
0
        public void GetDatalayers()
        {
            try
            {
                DataLayers dataLayers = _adapterProvider.GetDataLayers();
                string     xml        = Utility.Serialize <DataLayers>(dataLayers, true);

                HttpContext.Current.Response.ContentType = "application/xml";
                HttpContext.Current.Response.Write(xml);
            }
            catch (Exception e)
            {
                CustomErrorLog objCustomErrorLog = new CustomErrorLog();
                _CustomError = objCustomErrorLog.customErrorLogger(ErrorMessages.errGetDataLayer, e, _logger);
                objCustomErrorLog.throwJsonResponse(_CustomError);
            }
        }
Exemple #16
0
    public void InitComponentsAndListeners()
    {
        // Initialize component references
        mapController       = inspectorTool.Map;
        gridLayerController = mapController.GetLayerController <GridLayerController>();
        inspectorOutput     = inspectorTool.InspectOutput;
        dataLayers          = ComponentManager.Instance.Get <DataLayers>();
        mapViewArea         = ComponentManager.Instance.Get <MapViewArea>();
        siteBrowser         = ComponentManager.Instance.Get <SiteBrowser>();

        // Add listeners
        mapController.OnMapUpdate            += OnMapUpdate;
        mapViewArea.OnMapViewAreaChange      += OnMapViewAreaChange;
        siteBrowser.OnBeforeActiveSiteChange += OnBeforeActiveSiteChange;
        createAreaInspectionToggle.onValueChanged.AddListener(OnCreateInspectionChanged);
        removeAreaInspectionToggle.onValueChanged.AddListener(OnRemoveInspectionChanged);
    }
    //
    // Unity Methods
    //

    private void Awake()
    {
        originalTitleColor = title.color;
        originalValueColor = value.color;

        if (disabled)
        {
            SetDisabledColors();
        }

        var componentManager = ComponentManager.Instance;

        dataLayers  = componentManager.Get <DataLayers>();
        layoutGroup = componentManager.Get <ContoursTool>().InfoPanel.container.GetComponent <LayoutGroup>();

        // Initialize listener
        //translator.OnLanguageChanged += OnLanguageChanged;
        groupToggle.onValueChanged.AddListener(OnGroupToggleChanged);
    }
Exemple #18
0
    public void InitComponentsAndListeners()
    {
        // Get Components from inspectorTool
        map = inspectorTool.Map;
        gridLayerController = map.GetLayerController <GridLayerController>();
        patch           = inspectorTool.Patch;
        inspectorOutput = inspectorTool.InspectOutput;
        dataLayers      = ComponentManager.Instance.Get <DataLayers>();
        inputHandler    = ComponentManager.Instance.Get <InputHandler>();
        mapViewArea     = ComponentManager.Instance.Get <MapViewArea>();
        siteBrowser     = ComponentManager.Instance.Get <SiteBrowser>();

        // Add listeners
        map.OnMapUpdate += OnMapUpdate;
        mapViewArea.OnMapViewAreaChange      += OnMapViewAreaChange;
        siteBrowser.OnBeforeActiveSiteChange += OnBeforeActiveSiteChange;
        createLineInspectionToggle.onValueChanged.AddListener(OnCreateInspectionChanged);
        removeLineInspectionToggle.onValueChanged.AddListener(OnRemoveInspectionChanged);
    }
Exemple #19
0
    //
    // Event Methods
    //

    protected override void OnComponentRegistrationFinished()
    {
        base.OnComponentRegistrationFinished();

        // Get Components
        dataLayers          = ComponentManager.Instance.Get <DataLayers>();
        gridLayerController = map.GetLayerController <GridLayerController>();
        inputHandler        = ComponentManager.Instance.Get <InputHandler>();
        outputPanel         = ComponentManager.Instance.Get <OutputPanel>();
        mapViewArea         = ComponentManager.Instance.Get <MapViewArea>();
        canvas    = GameObject.FindWithTag("Canvas").GetComponent <Canvas>();
        infoPanel = FindObjectOfType <InfoPanel>();


        lineInspectorPanel.Init(toolLayers, canvas, maxInspectionCount);
        lineInspector = lineInspectorPanel.lineInspector;
        lineInfos     = lineInspectorPanel.lineInfos;

        areaInspector.Init(toolLayers);
        InitAreaInspectorInfo();
    }
    //
    // Unity Methods
    //

    private void Awake()
    {
        // Components
        var componentManager = ComponentManager.Instance;

        inspectorTool       = componentManager.Get <InspectorTool>();
        dataLayers          = componentManager.Get <DataLayers>();
        gridLayerController = inspectorTool.Map.GetLayerController <GridLayerController>();
        translator          = LocalizationManager.Instance;

        linePSUIRef.Init(translator);

        // Initialize dropdowns
        inspectorOutputDropdowns = new InspectorOutputDropdown[]
        {
            new InspectorOutputDropdown(linePSUIRef.summaryDropdown, PSO.LineSummaryOptions),
            new InspectorOutputDropdown(linePSUIRef.metricsDropdown, PSO.MetricsOptions)
        };
        InitDropdowns();

        // Initialize properties and summaries
        int maxInspectionCount = inspectorTool.maxInspectionCount;

        linePS = new LinePS[maxInspectionCount];
        for (int i = 0; i < maxInspectionCount; ++i)
        {
            linePS[i] = new LinePS();
        }

        // Initialize listeners
        gridLayerController.OnShowGrid += OnShowGrid;
        LocalizationManager.Instance.OnLanguageChanged += OnLanguageChanged;
        linePSUIRef.summaryDropdown.onValueChanged.AddListener(UpdateLinePanel);
        linePSUIRef.computeCorrelationButton.onClick.AddListener(OnComputeCorrelationClicked);

        // Default panel display
        UpdateLinePanel(LinePS.SelectedLine);
    }
Exemple #21
0
    //
    // Unity Methods
    //

    private IEnumerator Start()
    {
        messageController = FindObjectOfType <MessageController>();
        if (messageController != null)
        {
            messageController.Show(true);
            messageController.SetMessage("Loading ...");
        }

        yield return(WaitFor.Frames(WaitFor.InitialFrames - 1));     // -1 to initialize before all other components

        // Mandatory components
        var componentManager = ComponentManager.Instance;

        dataLayers       = componentManager.Get <DataLayers>();
        loadingComponent = componentManager.Get <LoadingComponent>();
        map = componentManager.Get <MapController>();

        InitMapControllers();

        // Load config (groups & layers)
        StartCoroutine(Init());
    }
Exemple #22
0
        private DataLayers GetDataLayers()
        {
            DataLayers dataLayers = new DataLayers();

            // Load NHibernate data layer
            Type      nhType      = typeof(NHibernateDataLayer);
            string    nhLibrary   = nhType.Assembly.GetName().Name;
            string    nhAssembly  = string.Format("{0}, {1}", nhType.FullName, nhLibrary);
            DataLayer nhDataLayer = new DataLayer {
                Assembly = nhAssembly, Name = nhLibrary, Configurable = true
            };

            dataLayers.Add(nhDataLayer);

            // Load Spreadsheet data layer
            Type      ssType      = typeof(SpreadsheetDatalayer);
            string    ssLibrary   = ssType.Assembly.GetName().Name;
            string    ssAssembly  = string.Format("{0}, {1}", ssType.FullName, ssLibrary);
            DataLayer ssDataLayer = new DataLayer {
                Assembly = ssAssembly, Name = ssLibrary, Configurable = true
            };

            dataLayers.Add(ssDataLayer);

            try
            {
                Assembly[] domainAssemblies = AppDomain.CurrentDomain.GetAssemblies();
                GetDataLayerTypes(ref dataLayers, domainAssemblies);
            }
            catch (Exception ex)
            {
                _logger.Error(string.Format("Error loading data layer: {0}" + ex));
            }

            return(dataLayers);
        }
Exemple #23
0
    public void UpdateLineInspectorOutput(LineInfo lineInfo, DataLayers dataLayers)
    {
        Dictionary <string, List <float> > idToValueList    = new Dictionary <string, List <float> >();
        Dictionary <string, int>           idToNoDataList   = new Dictionary <string, int>();
        Dictionary <string, string>        idToUnitsList    = new Dictionary <string, string>();
        Dictionary <string, Color>         idToDotColorList = new Dictionary <string, Color>();

        if (lineInfo != null)
        {
            var lineGrids          = lineInfo.mapLayer.grids;
            var lineInspectedGrids = lineInfo.mapLayer.inspectedGridsData;

            int lineGridsLength = lineGrids.Count;
            for (int i = 0; i < lineGridsLength; ++i)
            {
                var layerName = dataLayers.activeLayerPanels[i].name;
                var dotColor  = dataLayers.activeLayerPanels[i].dot.color;

                int lineInspectedGridsLength = lineInspectedGrids[lineGrids[i]].Count;
                for (int j = 0; j < lineInspectedGridsLength; ++j)
                {
                    // Add all cells to list
                    if (!idToValueList.ContainsKey(layerName))
                    {
                        List <float> data        = new List <float>();
                        int          noDataCount = 0;
                        float        value       = lineInspectedGrids[lineGrids[i]][j];
                        if (value > 0.0f)
                        {
                            data.Add(value);
                        }
                        else
                        {
                            ++noDataCount;
                        }
                        idToValueList.Add(layerName, data);
                        idToNoDataList.Add(layerName, noDataCount);
                    }
                    else
                    {
                        var   list  = idToValueList[layerName];
                        float value = lineInspectedGrids[lineGrids[i]][j];
                        if (value > 0.0f)
                        {
                            list.Add(value);
                        }
                        else
                        {
                            ++idToNoDataList[layerName];
                        }
                    }
                }

                if (!idToUnitsList.ContainsKey(layerName))
                {
                    idToUnitsList.Add(layerName, lineGrids[i].units);
                }

                if (!idToDotColorList.ContainsKey(layerName))
                {
                    idToDotColorList.Add(layerName, dotColor);
                }
            }
            ComputeAndUpdateNoDataLength(idToValueList, idToNoDataList);
            SetData(idToValueList, idToUnitsList, idToDotColorList, idToNoDataList);
        }
    }
Exemple #24
0
    //
    // Unity Methods
    //

    private void OnEnable()
    {
        map          = ComponentManager.Instance.Get <MapController>();
        dataLayers   = ComponentManager.Instance.Get <DataLayers>();
        inputHandler = ComponentManager.Instance.Get <InputHandler>();
    }
Exemple #25
0
        private void GetDataLayerTypes(ref DataLayers dataLayers, Assembly[] domainAssemblies)
        {
            foreach (Assembly asm in domainAssemblies)
            {
                Type[] asmTypes = null;
                try
                {
                    asmTypes = asm.GetTypes().Where(a => a != null && (
                                                        (typeof(IDataLayer).IsAssignableFrom(a) && !(a.IsInterface || a.IsAbstract)) ||
                                                        (typeof(ILightweightDataLayer).IsAssignableFrom(a) && !(a.IsInterface || a.IsAbstract)))
                                                    ).ToArray();
                }
                catch (ReflectionTypeLoadException e)
                {
                    // if we are running the the iRing site under Anonymous authentication with the DefaultApplicationPool Identity we
                    // can run into ReflectionPermission issues but as our datalayer assemblies are in our web site's bin folder we
                    // should be able to ignore the exceptions and work with the accessibe types loaded in e.Types.
                    asmTypes = e.Types.Where(a => a != null && (
                                                 (typeof(IDataLayer).IsAssignableFrom(a) && !(a.IsInterface || a.IsAbstract)) ||
                                                 (typeof(ILightweightDataLayer).IsAssignableFrom(a) && !(a.IsInterface || a.IsAbstract)))
                                             ).ToArray();
                    _logger.Warn("GetTypes() for " + asm.FullName + " cannot access all types, but datalayer loading is continuing: " + e);
                }

                try
                {
                    if (asmTypes.Any())
                    {
                        _logger.Debug("assembly:" + asm.FullName);
                        foreach (System.Type asmType in asmTypes)
                        {
                            _logger.Debug("asmType:" + asmType.ToString());

                            bool   isLW         = typeof(ILightweightDataLayer).IsAssignableFrom(asmType) && !(asmType.IsInterface || asmType.IsAbstract);
                            bool   configurable = asmType.BaseType.Equals(typeof(BaseConfigurableDataLayer));
                            string name         = asm.FullName.Split(',')[0];

                            if (name.ToLower() == "NHibernateExtension".ToLower())
                            {
                                continue;
                            }

                            if (!dataLayers.Exists(x => x.Name.ToLower() == name.ToLower()))
                            {
                                string assembly = string.Format("{0}, {1}", asmType.FullName, name);

                                DataLayer dataLayer = new DataLayer
                                {
                                    Assembly      = assembly,
                                    Name          = name,
                                    IsLightweight = isLW,
                                    Configurable  = configurable
                                };

                                dataLayers.Add(dataLayer);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    _logger.Error("Error loading data layer (while getting assemblies): " + e);
                }
            }
        }
Exemple #26
0
    public void UpdateContourInspectorOutput(DataLayers dataLayers)
    {
        Dictionary <string, List <float> > idToValueList    = new Dictionary <string, List <float> >();
        Dictionary <string, int>           idToNoDataList   = new Dictionary <string, int>();
        Dictionary <string, string>        idToUnitsList    = new Dictionary <string, string>();
        Dictionary <string, Color>         idToDotColorList = new Dictionary <string, Color>();

        if (contoursTool)
        {
            if (contoursTool.ContoursLayer == null)
            {
                return;
            }

            var contourGrids          = contoursTool.ContoursLayer.grids;
            var contourInspectedGrids = contoursTool.ContoursLayer.inspectedGridsData;

            int contourGridsLength = contourGrids.Count;
            for (int i = 0; i < contourGridsLength; ++i)
            {
                var layerName = dataLayers.activeLayerPanels[i].name;
                var dotColor  = dataLayers.activeLayerPanels[i].dot.color;

                int contourInspectedGridsLength = contourInspectedGrids[contourGrids[i]].Count;
                for (int j = 0; j < contourInspectedGridsLength; ++j)
                {
                    // Add all cells to list
                    if (!idToValueList.ContainsKey(layerName))
                    {
                        List <float> data        = new List <float>();
                        int          noDataCount = 0;
                        float        value       = contourInspectedGrids[contourGrids[i]][j];
                        if (value > 0.0f)
                        {
                            data.Add(value);
                        }
                        else
                        {
                            ++noDataCount;
                        }
                        idToValueList.Add(layerName, data);
                        idToNoDataList.Add(layerName, noDataCount);
                    }
                    else
                    {
                        var   list  = idToValueList[layerName];
                        float value = contourInspectedGrids[contourGrids[i]][j];
                        if (value > 0.0f)
                        {
                            list.Add(value);
                        }
                        else
                        {
                            ++idToNoDataList[layerName];
                        }
                    }
                }

                if (!idToUnitsList.ContainsKey(layerName))
                {
                    idToUnitsList.Add(layerName, contourGrids[i].units);
                }

                if (!idToDotColorList.ContainsKey(layerName))
                {
                    idToDotColorList.Add(layerName, dotColor);
                }

                contourDO.SetData(idToValueList, idToUnitsList, idToDotColorList, idToNoDataList, PlotContourData);
            }
        }
    }
Exemple #27
0
    public void UpdateAreaInspectorOutput(AreaInfo areaInfo, DataLayers dataLayers)
    {
        if (!areaPSUIRef.summaryDropdown.value.Equals(AreaPS.SelectedArea))
        {
            return;
        }

        Dictionary <string, List <float> > idToValueList    = new Dictionary <string, List <float> >();
        Dictionary <string, int>           idToNoDataList   = new Dictionary <string, int>();
        Dictionary <string, string>        idToUnitsList    = new Dictionary <string, string>();
        Dictionary <string, Color>         idToDotColorList = new Dictionary <string, Color>();

        if (areaInfo != null)
        {
            var areaGrids          = areaInfo.mapLayer.grids;
            var areaInspectedGrids = areaInfo.mapLayer.inspectedGridsData;

            int areaGridsLength = areaGrids.Count;
            for (int i = 0; i < areaGridsLength; ++i)
            {
                var layerName = dataLayers.activeLayerPanels[i].name;
                var dotColor  = dataLayers.activeLayerPanels[i].dot.color;

                int areaInspectedGridsLength = areaInspectedGrids[areaGrids[i]].Count;
                for (int j = 0; j < areaInspectedGridsLength; ++j)
                {
                    // Add all cells to list
                    if (!idToValueList.ContainsKey(layerName))
                    {
                        List <float> data        = new List <float>();
                        int          noDataCount = 0;
                        float        value       = areaInspectedGrids[areaGrids[i]][j];
                        if (value > 0.0f)
                        {
                            data.Add(value);
                        }
                        else
                        {
                            ++noDataCount;
                        }
                        idToValueList.Add(layerName, data);
                        idToNoDataList.Add(layerName, noDataCount);
                    }
                    else
                    {
                        var   list  = idToValueList[layerName];
                        float value = areaInspectedGrids[areaGrids[i]][j];
                        if (value > 0.0f)
                        {
                            list.Add(value);
                        }
                        else
                        {
                            ++idToNoDataList[layerName];
                        }
                    }
                }

                if (!idToUnitsList.ContainsKey(layerName))
                {
                    idToUnitsList.Add(layerName, areaGrids[i].units);
                }

                if (!idToDotColorList.ContainsKey(layerName))
                {
                    idToDotColorList.Add(layerName, dotColor);
                }
            }
            ComputeAndUpdateNoDataArea(idToValueList, idToNoDataList);
            areaDO.SetData(idToValueList, idToUnitsList, idToDotColorList, idToNoDataList, PlotAreaData);
        }
    }
    //
    // Unity Methods
    //

    private void Start()
    {
        dataLayers = ComponentManager.Instance.Get <DataLayers>();

        gameObject.SetActive(false);
    }