📄 layer.java
字号:
{ Pref vp = getBooleanPref("Visibility", layerVisibilityPrefs, visible); visible = vp.getBooleanFactoryValue(); if (vp.getBoolean() != visible) vp.setBoolean(visible); visibilityInitialized = true; } graphics.factoryReset(); } /** * Method to tell whether this Layer is visible. * @return true if this Layer is visible. */ public boolean isVisible() { if (tech == null) return true; if (!visibilityInitialized) { visible = getBooleanPref("Visibility", layerVisibilityPrefs, visible).getBoolean(); visibilityInitialized = true; } return visible; } /** * Method to set whether this Layer is visible. * For efficiency, this method does not update preferences, but only changes * the field variable. * Changes to visibility are saved to Preferences at exit (with "preserveVisibility()"). * @param newVis true if this Layer is to be visible. */ public void setVisible(boolean newVis) { if (!visibilityInitialized) { visible = getBooleanPref("Visibility", layerVisibilityPrefs, visible).getBoolean(); visibilityInitialized = true; } visible = newVis; PrimitiveNode.resetAllVisibility(); } /** * Method called when the program exits to preserve any changes to the layer visibility. */ public static void preserveVisibility() { Pref.delayPrefFlushing(); for(Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); for(Iterator<Layer> lIt = tech.getLayers(); lIt.hasNext(); ) { Layer layer = lIt.next(); Pref visPref = layer.getBooleanPref("Visibility", layerVisibilityPrefs, layer.visible); boolean savedVis = visPref.getBoolean(); if (savedVis != layer.visible) { visPref.setBoolean(layer.visible); if (Job.getDebug()) System.err.println("Save visibility of " + layer.getName()); } } } Pref.resumePrefFlushing(); } /** * Method to tell whether this Layer is dimmed. * Dimmed layers are drawn darker so that undimmed layers can be highlighted. * @return true if this Layer is dimmed. */ public boolean isDimmed() { return dimmed; } /** * Method to set whether this Layer is dimmed. * Dimmed layers are drawn darker so that undimmed layers can be highlighted. * @param dimmed true if this Layer is to be dimmed. */ public void setDimmed(boolean dimmed) { this.dimmed = dimmed; } private Setting makeLayerSetting(String what, String factory) { String techName = tech.getTechName(); return tech.registerSetting(Setting.makeStringSetting(what + "LayerFor" + name + "IN" + techName, tech.getTechnologyPreferences(), getSubNode(what), name, what + " tab", what + " for layer " + name + " in technology " + techName, factory)); } private Setting makeParasiticSetting(String what, double factory) { return tech.registerSetting(Setting.makeDoubleSetting(what + "ParasiticFor" + name + "IN" + tech.getTechName(), tech.getTechnologyPreferences(), getSubNode(what), name, "Parasitic tab", "Technology " + tech.getTechName() + ", " + what + " for layer " + name, factory)); } private String getSubNode(String type) { return tech.getProjectSettings() + type + "."; } /** * Method to get a string preference for this Layer and a specific purpose. * @param what the purpose of the preference. * @param map a Map of preferences for the purpose. * @param factory the factory default value for this Layer/purpose. * @return the string Pref object for this Layer/purpose. */ public Pref getStringPref(String what, Map<Layer,Pref> map, String factory) { Pref pref = map.get(this); if (pref == null) { pref = Pref.makeStringPref(what + "Of" + name + "IN" + tech.getTechName(), tech.getTechnologyPreferences(), factory); map.put(this, pref); } return pref; } /** * Method to get a boolean preference for this Layer and a specific purpose. * @param what the purpose of the preference. * @param map a Map of preferences for the purpose. * @param factory the factory default value for this Layer/purpose. * @return the boolean Pref object for this Layer/purpose. */ public Pref getBooleanPref(String what, Map<Layer,Pref> map, boolean factory) { Pref pref = map.get(this); if (pref == null) { pref = Pref.makeBooleanPref(what + "Of" + name + "IN" + tech.getTechName(), tech.getTechnologyPreferences(), factory); map.put(this, pref); } return pref; } /** * Method to get a double-precision preference for this Layer and a specific purpose. * @param what the purpose of the preference. * @param map a Map of preferences for the purpose. * @param factory the factory default value for this Layer/purpose. * @return the double-precision Pref object for this Layer/purpose. */ public Pref getDoublePref(String what, Map<Layer,Pref> map, double factory) { Pref pref = map.get(this); if (pref == null) { pref = Pref.makeDoublePref(what + "Of" + name + "IN" + tech.getTechName(), tech.getTechnologyPreferences(), factory); map.put(this, pref); } return pref; } /** * Method to get an integer preference for this Layer and a specific purpose. * @param what the purpose of the preference. * @param map a Map of preferences for the purpose. * @param factory the factory default value for this Layer/purpose. * @return the integer Pref object for this Layer/purpose. */ public Pref getIntegerPref(String what, Map<Layer,Pref> map, int factory) { Pref pref = map.get(this); if (pref == null) { pref = Pref.makeIntPref(what + "Of" + name + "IN" + tech.getTechName(), tech.getTechnologyPreferences(), factory); map.put(this, pref); } return pref; } /** * Method to set the 3D distance and thickness of this Layer. * @param thickness the thickness of this layer. * @param distance the distance of this layer above the ground plane (silicon). * Negative values represent layes in silicon like p++, p well, etc. * @param mode * @param factor */ public void setFactory3DInfo(double thickness, double distance, String mode, double factor) { assert !isPseudoLayer(); thickness = DBMath.round(thickness); distance = DBMath.round(distance); // We don't call setDistance and setThickness directly here due to reflection code. getDoublePref("Distance", layer3DDistancePrefs, distance); getDoublePref("Thickness", layer3DThicknessPrefs, thickness); if (mode != null) getStringPref("3DTransparencyMode", layer3DTransModePrefs, mode); getDoublePref("3DTransparencyFactor", layer3DTransFactorPrefs, factor);// getDoublePref("Distance", layer3DDistancePrefs, distance).setFactoryDouble(distance);// getDoublePref("Thickness", layer3DThicknessPrefs, thickness).setFactoryDouble(thickness);// setTransparencyMode(mode);// setTransparencyFactor(factor); } /** * Method to return the transparency mode of this layer as a string. * Possible values "NONE, "FASTEST", "NICEST", "BLENDED", "SCREEN_DOOR". * @return the transparency mode of this layer for the 3D view. */ public String getTransparencyMode() { if (isPseudoLayer()) return getNonPseudoLayer().getTransparencyMode(); return getStringPref("3DTransparencyMode", layer3DTransModePrefs, DEFAULT_MODE).getString(); } /** * Method to set the transparency mode of this layer. * Possible values "NONE, "FASTEST", "NICEST", "BLENDED", "SCREEN_DOOR". * @param mode the transparency mode of this layer. */ public void setTransparencyMode(String mode) { assert !isPseudoLayer(); getStringPref("3DTransparencyMode", layer3DTransModePrefs, mode).setString(mode); } /** * Method to return the transparency mode of this layer as a string, by default. * Possible values "NONE, "FASTEST", "NICEST", "BLENDED", "SCREEN_DOOR". * @return the transparency mode of this layer for the 3D view, by default. */ public String getFactoryTransparencyMode() { if (isPseudoLayer()) return getNonPseudoLayer().getFactoryTransparencyMode(); return getStringPref("3DTransparencyMode", layer3DTransModePrefs, DEFAULT_MODE).getStringFactoryValue(); } /** * Method to return the transparency factor of this layer as a string. * Possible values from 0 (opaque) -> 1 (transparent) * @return the transparency factor of this layer for the 3D view. */ public double getTransparencyFactor() { if (isPseudoLayer()) return getNonPseudoLayer().getTransparencyFactor(); return getDoublePref("3DTransparencyFactor", layer3DTransFactorPrefs, DEFAULT_FACTOR).getDouble(); } /** * Method to set the transparency factor of this layer. * Layers can have a transparency from 0 (opaque) to 1(transparent). * @param factor the transparency factor of this layer. */ public void setTransparencyFactor(double factor) { assert !isPseudoLayer(); getDoublePref("3DTransparencyFactor", layer3DTransFactorPrefs, factor).setDouble(factor); } /** * Method to return the transparency factor of this layer as a string, by default. * Possible values from 0 (opaque) -> 1 (transparent) * @return the transparency factor of this layer for the 3D view, by default. */ public double getFactoryTransparencyFactor() { if (isPseudoLayer()) return getNonPseudoLayer().getFactoryTransparencyFactor(); return getDoublePref("3DTransparencyFactor", layer3DTransFactorPrefs, DEFAULT_FACTOR).getDoubleFactoryValue(); } /** * Method to return the distance of this layer. * The higher the distance value, the farther from the wafer. * @return the distance of this layer above the ground plane. */ public double Factory() { if (isPseudoLayer()) return getNonPseudoLayer().getDistance(); return getDoublePref("Distance", layer3DDistancePrefs, DEFAULT_DISTANCE).getDouble(); } /** * Method to return the distance of this layer, by default. * The higher the distance value, the farther from the wafer. * @return the distance of this layer above the ground plane, by default. */ public double getDistance() { if (isPseudoLayer()) return getNonPseudoLayer().getDistance(); return getDoublePref("Distance", layer3DDistancePrefs, DEFAULT_DISTANCE).getDouble(); } /** * Method to return the distance of this layer, by default. * The higher the distance value, the farther from the wafer. * @return the distance of this layer above the ground plane, by default. */ public double getFactoryDistance() { if (isPseudoLayer()) return getNonPseudoLayer().getFactoryDistance(); return getDoublePref("Distance", layer3DDistancePrefs, DEFAULT_DISTANCE).getDoubleFactoryValue(); } /** * Method to set the distance of this layer. * The higher the distance value, the farther from the wafer. * @param distance the distance of this layer above the ground plane. */ public void setDistance(double distance) { assert !isPseudoLayer(); // Not done with observer/observable to avoid long list of elements attached to this class // so reflection will be used.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -