diff --git a/altium_sch_renderer.js b/altium_sch_renderer.js index e03a354..d74e3ff 100644 --- a/altium_sch_renderer.js +++ b/altium_sch_renderer.js @@ -168,12 +168,12 @@ class AltiumSchematicRenderer // incoming/outgoing direction. this.graph.getAllConnectionConstraints = function(terminal) { var geo = (terminal != null) ? this.getCellGeometry(terminal.cell) : null; - console.log("getAllConnectionConstraints ") + console.log("getAllConnectionConstraints ",terminal) if ((geo != null ? !geo.relative : false) && this.getModel().isVertex(terminal.cell) && this.getModel().getChildCount(terminal.cell) == 0) { - return [new mxConnectionConstraint(new mxPoint(0, 0.5), false), + return [ new mxConnectionConstraint(new mxPoint(1, 0.5), false)]; } return null; @@ -400,22 +400,22 @@ class AltiumSchematicRenderer { obj.top = 840 - obj.top obj.bottom = 840 - obj.bottom - - console.log('verticalLabelPosition=top;verticalAlign=bottom;fillColor=' - + this.#altiumColourToHex(obj.attributes.areacolor)) - let v1 = this.graph.insertVertex(parent, null, '', - obj.left, obj.top, - (obj.right - obj.left), - (obj.bottom - obj.top), - 'verticalLabelPosition=top;verticalAlign=bottom;fillColor=' - + this.#altiumColourToHex(obj.attributes.areacolor)); - v1.setConnectable(false); - if(chips[obj.owner_record_index] == undefined){ - chips[obj.owner_record_index] = [] + if(!obj.transparent){ + console.log('verticalLabelPosition=top;verticalAlign=bottom;fillColor=' + + this.#altiumColourToHex(obj.attributes.areacolor)) + let v1 = this.graph.insertVertex(parent, null, '', + obj.left, obj.top, + (obj.right - obj.left), + (obj.bottom - obj.top), + 'verticalLabelPosition=top;verticalAlign=bottom;fillColor=' + + this.#altiumColourToHex(obj.attributes.areacolor)); + v1.setConnectable(false); + if(chips[obj.owner_record_index] == undefined){ + chips[obj.owner_record_index] = [] + } + v1.geometry.relative = false + chips[obj.owner_record_index].push(v1) } - v1.geometry.relative = false - chips[obj.owner_record_index].push(v1) - // if (!this.#shouldShow(obj)) // continue; // ctx.fillStyle = this.#altiumColourToHex(obj.attributes.areacolor); @@ -446,7 +446,6 @@ class AltiumSchematicRenderer // } // ctx.stroke(); } - for (let obj of doc.objects.filter((o) => o instanceof AltiumTextFrame)) { obj = obj @@ -466,23 +465,7 @@ class AltiumSchematicRenderer // } } - for (let obj of doc.objects.filter((o) => o instanceof AltiumEllipse)) - { - obj = obj - // if (!this.#shouldShow(obj)) continue; - - // if (!obj.transparent) - // { - // ctx.fillStyle = this.#altiumColourToHex(obj.fill_colour); - // } - // ctx.strokeStyle = this.#altiumColourToHex(obj.line_colour); - // ctx.beginPath(); - // ctx.ellipse(obj.x, obj.y, obj.radius_x, obj.radius_y, 0, 0, Math.PI*2); - // ctx.stroke(); - // if (!obj.transparent) - // ctx.fill(); - } for (let obj of doc.objects.filter((o) => o instanceof AltiumPin)) { var style = 'shape=line;fontColor=#000000;strokeColor=#000000;' @@ -518,6 +501,7 @@ class AltiumSchematicRenderer if(chips[obj.owner_record_index] == undefined){ chips[obj.owner_record_index] = [] } + console.log(v11.geometry.getTerminalPoint (true)) chips[obj.owner_record_index].push(v11) // v11.geometry.offset = new mxPoint(-v11.geometry.width, 2); // ctx.strokeStyle = "#000000"; @@ -532,7 +516,30 @@ class AltiumSchematicRenderer // ctx.fill(); } - + for (let obj of doc.objects.filter((o) => o instanceof AltiumEllipse)) + { + obj = obj + obj.y = 840-obj.y + let v1 = this.graph.insertVertex(parent, null, '', + obj.x - obj.radius_x, obj.y - obj.radius_x, + obj.radius_x*2, obj.radius_y*2,'shape=ellipse;fillColor=' + + this.#altiumColourToHex(obj.fill_colour)); + v1.setConnectable(false) + chips[obj.owner_record_index].push(v1) + + // if (!this.#shouldShow(obj)) continue; + + // if (!obj.transparent) + // { + // ctx.fillStyle = this.#altiumColourToHex(obj.fill_colour); + // } + // ctx.strokeStyle = this.#altiumColourToHex(obj.line_colour); + // ctx.beginPath(); + // ctx.ellipse(obj.x, obj.y, obj.radius_x, obj.radius_y, 0, 0, Math.PI*2); + // ctx.stroke(); + // if (!obj.transparent) + // ctx.fill(); + } for (let obj of doc.objects.filter((o) => o instanceof AltiumLine)) { mxCellRenderer.registerShape('polyline', mxPolyline); obj.x2 = 840 - obj.x2