📄 techexplorer.java
字号:
// Cell_lowLevelPopulate.invoke(cell, cellName);// Cell_lowLevelLink.invoke(cell);// } else {// cell = Cell_newInstance.invoke(null, lib, cellName);// }// Object ni = null;// if (NodeInst_newInstance1 != null)// ni = NodeInst_newInstance1.invoke(null, pn, new Point2D.Double(), Double.valueOf(10), Double.valueOf(10), cell);// else if (NodeInst_newInstance2 != null)// ni = NodeInst_newInstance2.invoke(null, pn, new Point2D.Double(), Double.valueOf(10), Double.valueOf(10), Integer.valueOf(0), cell, null);// Object[] polys = null;// if (Technology_getShapeOfNode1 != null)// polys = (Object[])Technology_getShapeOfNode1.invoke(tech, ni, Boolean.FALSE, Boolean.FALSE, null);// else if (Technology_getShapeOfNode2 != null)// polys = (Object[])Technology_getShapeOfNode2.invoke(tech, ni, null, null, Boolean.FALSE, Boolean.FALSE, null);// else if (Technology_getShapeOfNode3 != null)// polys = (Object[])Technology_getShapeOfNode3.invoke(tech, ni, null, null, Boolean.FALSE, Boolean.FALSE, null);// else if (Technology_getShapeOfNode4 != null)// polys = (Object[])Technology_getShapeOfNode4.invoke(tech, ni, null, null, Boolean.FALSE, Boolean.FALSE, null);// else if (Technology_getShapeOfNode5 != null)// polys = (Object[])Technology_getShapeOfNode5.invoke(tech, ni, null, Boolean.FALSE, Boolean.FALSE, null);// else if (Technology_getShapeOfNode6 != null)// polys = (Object[])Technology_getShapeOfNode6.invoke(tech, ni, null, Boolean.FALSE, Boolean.FALSE);// for (Object poly: polys) {// System.out.print("Poly " + Poly_getStyle.invoke(poly).toString());// Point2D[] points = (Point2D[])Poly_getPoints.invoke(poly);// for (Point2D p: points)// System.out.print(" " + p.getX() + "," + p.getY());// System.out.println();// }//// } public Xml.Technology makeXml(String techName) throws IllegalAccessException, InvocationTargetException { Object tech = Technology_findTechnology.invoke(null, techName); Xml.Technology t = new Xml.Technology(); t.techName = techName; t.className = tech.getClass().getName(); if (t.className.equals("com.sun.electric.technology.Technology")) t.className = null; Xml.Version version; version = new Xml.Version(); version.techVersion = 1; version.electricVersion = Technology.DISK_VERSION_1; t.versions.add(version); version = new Xml.Version(); version.techVersion = 2; version.electricVersion = Technology.DISK_VERSION_2; t.versions.add(version); t.shortTechName = (String)Technology_getTechShortName.invoke(tech); t.description = (String)Technology_getTechDesc.invoke(tech); t.scaleValue = (Double)Technology_getScale.invoke(tech); t.scaleRelevant = (Boolean)Technology_isScaleRelevant.invoke(tech); t.defaultFoundry = "NONE"; if (Technology_getPrefFoundry != null) t.defaultFoundry = Technology_getPrefFoundry.invoke(tech).toString(); t.minResistance = (Double)Technology_getMinResistance.invoke(tech); t.minCapacitance = (Double)Technology_getMinCapacitance.invoke(tech); int numTransparentLayers = (Integer)Technology_getNumTransparentLayers.invoke(tech); if (numTransparentLayers > 0) { Color[] colorMap = (Color[])Technology_getColorMap.invoke(tech); for (int i = 0; i < numTransparentLayers; i++) { Color transparentColor = colorMap[1 << i]; t.transparentLayers.add(transparentColor); } }// makeFoundries(t, tech); int maxMetal = 0; for (Iterator<?> it = (Iterator)Technology_getLayers.invoke(tech); it.hasNext(); ) { Object layer = it.next(); if (isPseudoLayer(layer)) continue; String layerName = (String)Layer_getName.invoke(layer); Xml.Layer l = new Xml.Layer(); l.name = layerName; Object fun = Layer_getFunction.invoke(layer); l.function = fun != null ? LayerFunctions.get(fun) : Layer.Function.UNKNOWN; if (l.function.isMetal()) maxMetal = Math.max(maxMetal, l.function.getLevel()); l.extraFunction = (Integer)Layer_getFunctionExtras.invoke(layer); Object desc = Layer_getGraphics.invoke(layer); boolean displayPatterned = (Boolean)EGraphics_isPatternedOnDisplay.invoke(desc); boolean printPatterned = (Boolean)EGraphics_isPatternedOnPrinter.invoke(desc); EGraphics.Outline outlineWhenPatterned = EGraphics.Outline.NOPAT; if (EGraphics_getOutlined != null) { Object outline = EGraphics_getOutlined.invoke(desc); if (outline != null) outlineWhenPatterned = EGraphicsOutlines.get(outline); } else { if (EGraphics_isOutlinedOnDisplay != null && (Boolean)EGraphics_isOutlinedOnDisplay.invoke(desc)) outlineWhenPatterned = EGraphics.Outline.PAT_S; if (EGraphics_isOutlinedOnPrinter != null && (Boolean)EGraphics_isOutlinedOnPrinter.invoke(desc)) outlineWhenPatterned = EGraphics.Outline.PAT_S; } int transparentLayer = (Integer)EGraphics_getTransparentLayer.invoke(desc); Color color = (Color)EGraphics_getColor.invoke(desc); double opacity = (Double)EGraphics_getOpacity.invoke(desc); boolean foreground = (Boolean)EGraphics_getForeground.invoke(desc); int[] pattern = (int[])EGraphics_getPattern.invoke(desc); l.desc = new EGraphics(displayPatterned, printPatterned, outlineWhenPatterned, transparentLayer, color.getRed(), color.getGreen(), color.getBlue(), opacity, foreground, pattern); l.thick3D = (Double)Layer_getThickness.invoke(layer); if (Layer_getDistance != null) l.height3D = (Double)Layer_getDistance.invoke(layer); else if (Layer_getHeight != null) l.height3D = (Double)Layer_getHeight.invoke(layer); if (Layer_getTransparencyMode != null) l.mode3D = (String)Layer_getTransparencyMode.invoke(layer); if (Layer_getTransparencyFactor != null) l.factor3D = (Double)Layer_getTransparencyFactor.invoke(layer); if (l.thick3D == 0 && l.height3D == 0 && l.mode3D.equals("NONE") && l.factor3D == 0) l.mode3D = null; l.cif = (String)Layer_getCIFLayer.invoke(layer); l.skill = (String)Layer_getSkillLayer.invoke(layer); l.resistance = (Double)Layer_getResistance.invoke(layer); l.capacitance = (Double)Layer_getCapacitance.invoke(layer); l.edgeCapacitance = (Double)Layer_getEdgeCapacitance.invoke(layer); t.layers.add(l); } if (Technology_getNumMetals != null) maxMetal = (Integer)Technology_getNumMetals.invoke(tech); t.minNumMetals = t.maxNumMetals = t.defaultNumMetals = maxMetal; Map<String,?> oldArcNames = Technology_getOldArcNames != null ? (Map)Technology_getOldArcNames.invoke(tech) : Collections.emptyMap(); for (Iterator<?> it = (Iterator)Technology_getArcs.invoke(tech); it.hasNext(); ) { Object ap = it.next(); String arcName = (String)ArcProto_getName.invoke(ap); Xml.ArcProto a = new Xml.ArcProto(); a.name = arcName; for (Map.Entry<String,?> e: oldArcNames.entrySet()) { if (e.getValue() == ap) a.oldName = e.getKey(); } a.function = ArcProtoFunctions.get(ArcProto_getFunction.invoke(ap)); a.wipable = (Boolean)ArcProto_isWipable.invoke(ap); a.curvable = (Boolean)ArcProto_isCurvable.invoke(ap); a.special = ArcProto_isSpecialArc != null && (Boolean)ArcProto_isSpecialArc.invoke(ap); a.skipSizeInPalette = ArcProto_isSkipSizeInPalette != null && (Boolean)ArcProto_isSkipSizeInPalette.invoke(ap); a.notUsed = (Boolean)ArcProto_isNotUsed.invoke(ap); a.extended = (Boolean)ArcProto_isExtended.invoke(ap); a.fixedAngle = (Boolean)ArcProto_isFixedAngle.invoke(ap); a.angleIncrement = (Integer)ArcProto_getAngleIncrement.invoke(ap); if (ERC_getAntennaRatio != null) a.antennaRatio = (Double)ERC_getAntennaRatio.invoke(ERC_tool.get(null), ap); else if (ArcProto_getAntennaRatio != null) a.antennaRatio = (Double)ArcProto_getAntennaRatio.invoke(ap); double defaultFullWidth = 0; if (ArcProto_getLambdaElibWidthOffset != null && ArcProto_getDefaultLambdaBaseWidth != null) defaultFullWidth = (Double)ArcProto_getLambdaElibWidthOffset.invoke(ap) + (Double)ArcProto_getDefaultLambdaBaseWidth.invoke(ap); else if (ArcProto_getDefaultLambdaFullWidth != null) defaultFullWidth = (Double)ArcProto_getDefaultLambdaFullWidth.invoke(ap); else if (ArcProto_getDefaultWidth != null) defaultFullWidth = (Double)ArcProto_getDefaultWidth.invoke(ap); double widthOffset = 0; if (ArcProto_getLambdaElibWidthOffset != null) widthOffset = (Double)ArcProto_getLambdaElibWidthOffset.invoke(ap); else if (ArcProto_getLambdaWidthOffset != null) widthOffset = (Double)ArcProto_getLambdaWidthOffset.invoke(ap); else if (ArcProto_getWidthOffset != null) widthOffset = (Double)ArcProto_getWidthOffset.invoke(ap); if (widthOffset != 0) { a.diskOffset.put(Integer.valueOf(1), round(0.5*defaultFullWidth)); a.diskOffset.put(Integer.valueOf(2), round(0.5*(defaultFullWidth - widthOffset))); } else { a.diskOffset.put(Integer.valueOf(2), round(0.5*defaultFullWidth)); } Object[] arcLayers = (Object[])ArcProto_layers.get(ap); for (Object arcLayer: arcLayers) { Xml.ArcLayer al = new Xml.ArcLayer(); al.layer = (String)Layer_getName.invoke(TechnologyArcLayer_getLayer.invoke(arcLayer)); al.style = PolyTypes.get(TechnologyArcLayer_getStyle.invoke(arcLayer)); double extend = 0; if (TechnologyArcLayer_getGridExtend != null) { extend = DBMath.gridToLambda((Integer)TechnologyArcLayer_getGridExtend.invoke(arcLayer)); } else { double offset = 0; if (TechnologyArcLayer_getLambdaOffset != null) offset = (Double)TechnologyArcLayer_getLambdaOffset.invoke(arcLayer); else if (TechnologyArcLayer_getOffset != null) offset = (Double)TechnologyArcLayer_getOffset.invoke(arcLayer); extend = 0.5*(defaultFullWidth - offset); } al.extend.addLambda(round(extend)); a.arcLayers.add(al); } t.arcs.add(a); } Map<String,?> oldNodeNames = Technology_getOldNodeNames != null ? (Map)Technology_getOldNodeNames.invoke(tech) : Collections.emptyMap(); for (Iterator<?> it = (Iterator)Technology_getNodes.invoke(tech); it.hasNext(); ) { Object pn = it.next(); String nodeName = (String)PrimitiveNode_getName.invoke(pn); PrimitiveNode.Function fun = PrimitiveNodeFunctions.get(PrimitiveNode_getFunction.invoke(pn)); Object[] nodeLayersArray = (Object[])PrimitiveNode_getLayers.invoke(pn); double defWidth = (Double)PrimitiveNode_getDefWidth.invoke(pn); double defHeight = (Double)PrimitiveNode_getDefHeight.invoke(pn); Iterator<?> ports = (Iterator)PrimitiveNode_getPorts.invoke(pn); if (fun == PrimitiveNode.Function.NODE && nodeLayersArray.length == 1) { Xml.PureLayerNode pln = new Xml.PureLayerNode(); pln.name = nodeName; for (Map.Entry<String,?> e: oldNodeNames.entrySet()) { if (e.getValue() == pn) pln.oldName = e.getKey(); } Object port = ports.next(); pln.port = (String)PrimitivePort_getName.invoke(port); pln.style = PolyTypes.get(TechnologyNodeLayer_getStyle.invoke(nodeLayersArray[0])); pln.size.addLambda(round(defWidth)); makePortArcs(pln.portArcs, tech, port, null); Xml.Layer layer = t.findLayer((String)Layer_getName.invoke(TechnologyNodeLayer_getLayer.invoke(nodeLayersArray[0]))); layer.pureLayerNode = pln; continue; } Xml.PrimitiveNode n = new Xml.PrimitiveNode(); n.name = nodeName; for (Map.Entry<String,?> e: oldNodeNames.entrySet()) { if (e.getValue() == pn) n.oldName = e.getKey(); } n.function = fun; n.shrinkArcs = (Boolean)PrimitiveNode_isArcsShrink.invoke(pn); n.square = (Boolean)PrimitiveNode_isSquare.invoke(pn); n.canBeZeroSize = (Boolean)PrimitiveNode_isCanBeZeroSize.invoke(pn);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -