Ejemplo n.º 1
0
    private void pSetLayerSettings(EntropyLayerSettings entropyLayerSettings, int settingsIndex, bool gdsOnly, bool updateGeoCoreGeometryFromFile = false)
    {
        // This is used by the pasteHandler and clearHandler to set user interface values to align with the settings.
        // It is also used by the load from disk file system, using a temporary MCSettings instance as the source
        // In the case of the clearHandler, we get sent a new MCLayerSettings instance, so we have to handle that.
        // Check our copyFrom reference. We need to do this early before anything could change.

        if (!gdsOnly)
        {
            if (commonVars.isCopyPrepped())
            {
                if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.xOL_corr) == 1 || entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.yOL_corr) == 1 || entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.CDU_corr) == 1)
                {
                    // User pasting into the correlation layer. Disable correlation settings accordingly.
                    if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.xOL_corr_ref) == settingsIndex)
                    {
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.xOL_corr, 0);
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.xOL_corr_ref, -1);
                    }
                    if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.yOL_corr_ref) == settingsIndex)
                    {
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.yOL_corr, 0);
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.yOL_corr_ref, -1);
                    }
                    if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.xOL_ref) == settingsIndex)
                    {
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.xOL_ref, -1);
                    }
                    if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.yOL_ref) == settingsIndex)
                    {
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.yOL_ref, -1);
                    }
                    if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.CDU_corr_ref) == settingsIndex)
                    {
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.CDU_corr, 0);
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.CDU_corr_ref, -1);
                    }
                    if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.tCDU_corr_ref) == settingsIndex)
                    {
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.tCDU_corr, 0);
                        entropyLayerSettings.setInt(EntropyLayerSettings.properties_i.tCDU_corr_ref, -1);
                    }
                }
            }
        }

        // Remove any average overlay reference to the layer we're in, just for safety.
        entropyLayerSettings.setIntArrayValue(EntropyLayerSettings.properties_intarray.xOLRefs, settingsIndex, 0);
        entropyLayerSettings.setIntArrayValue(EntropyLayerSettings.properties_intarray.yOLRefs, settingsIndex, 0);

        try
        {
            // Call with '-1' can be triggered by load of project file where the copyFrom isn't set because we're direct driving the DOE flags.
            if (commonVars.isCopyPrepped())
            {
                commonVars.getSimulationSettings().getDOESettings().setLayerAffected(settingsIndex, commonVars.getCopyDOEUse());
            }
        }
        catch (Exception)
        {
        }

        if (entropyLayerSettings.getDecimal(EntropyLayerSettings.properties_decimal.sCDU) != 0.0m && entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.shapeIndex) == (int)CommonVars.shapeNames.GEOCORE &&
            varianceContext.geoCoreCDVariation == false)
        {
            ErrorReporter.showMessage_OK("Project uses Oasis/GDS CD variation.", "Overriding preference.");
        }

        if (commonVars.isCopyPrepped())
        {
            // Align the external data.
            commonVars.pasteGeoCoreHandler(settingsIndex);
            // commonVars.getGeoCoreHandler(settingsIndex).readValues(commonVars.copyLayerGHSettings);
        }
        else
        {
            commonVars.getGeoCoreHandler(settingsIndex).setValid(false);
            if (entropyLayerSettings.getInt(EntropyLayerSettings.properties_i.shapeIndex) == (int)CommonVars.shapeNames.GEOCORE && entropyLayerSettings.isReloaded())
            {
                commonVars.getGeoCoreHandler(settingsIndex).setFilename(entropyLayerSettings.getString(EntropyLayerSettings.properties_s.file));
                commonVars.getGeoCoreHandler(settingsIndex).setValid(true);
                if (updateGeoCoreGeometryFromFile)
                {
                    commonVars.getGeoCoreHandler(settingsIndex).setPoints(commonVars.getLayerSettings(settingsIndex).getInt(EntropyLayerSettings.properties_i.structure), commonVars.getLayerSettings(settingsIndex).getInt(EntropyLayerSettings.properties_i.lD));
                }
            }
        }

        // Commit our settings to the list.
        commonVars.getLayerSettings(settingsIndex).adjustSettings(entropyLayerSettings, gdsOnly);
    }