pin只有一端可以进行连线。

main
zcy 2024-03-09 01:18:31 +08:00
parent 4d4ac37e73
commit 1b08d6592e
1 changed files with 42 additions and 35 deletions

View File

@ -168,12 +168,12 @@ class AltiumSchematicRenderer
// incoming/outgoing direction. // incoming/outgoing direction.
this.graph.getAllConnectionConstraints = function(terminal) { this.graph.getAllConnectionConstraints = function(terminal) {
var geo = (terminal != null) ? this.getCellGeometry(terminal.cell) : null; var geo = (terminal != null) ? this.getCellGeometry(terminal.cell) : null;
console.log("getAllConnectionConstraints ") console.log("getAllConnectionConstraints ",terminal)
if ((geo != null ? !geo.relative : false) && if ((geo != null ? !geo.relative : false) &&
this.getModel().isVertex(terminal.cell) && this.getModel().isVertex(terminal.cell) &&
this.getModel().getChildCount(terminal.cell) == 0) this.getModel().getChildCount(terminal.cell) == 0)
{ {
return [new mxConnectionConstraint(new mxPoint(0, 0.5), false), return [
new mxConnectionConstraint(new mxPoint(1, 0.5), false)]; new mxConnectionConstraint(new mxPoint(1, 0.5), false)];
} }
return null; return null;
@ -400,7 +400,7 @@ class AltiumSchematicRenderer
{ {
obj.top = 840 - obj.top obj.top = 840 - obj.top
obj.bottom = 840 - obj.bottom obj.bottom = 840 - obj.bottom
if(!obj.transparent){
console.log('verticalLabelPosition=top;verticalAlign=bottom;fillColor=' console.log('verticalLabelPosition=top;verticalAlign=bottom;fillColor='
+ this.#altiumColourToHex(obj.attributes.areacolor)) + this.#altiumColourToHex(obj.attributes.areacolor))
let v1 = this.graph.insertVertex(parent, null, '', let v1 = this.graph.insertVertex(parent, null, '',
@ -415,7 +415,7 @@ class AltiumSchematicRenderer
} }
v1.geometry.relative = false v1.geometry.relative = false
chips[obj.owner_record_index].push(v1) chips[obj.owner_record_index].push(v1)
}
// if (!this.#shouldShow(obj)) // if (!this.#shouldShow(obj))
// continue; // continue;
// ctx.fillStyle = this.#altiumColourToHex(obj.attributes.areacolor); // ctx.fillStyle = this.#altiumColourToHex(obj.attributes.areacolor);
@ -446,7 +446,6 @@ class AltiumSchematicRenderer
// } // }
// ctx.stroke(); // ctx.stroke();
} }
for (let obj of doc.objects.filter((o) => o instanceof AltiumTextFrame)) for (let obj of doc.objects.filter((o) => o instanceof AltiumTextFrame))
{ {
obj = obj 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)) for (let obj of doc.objects.filter((o) => o instanceof AltiumPin))
{ {
var style = 'shape=line;fontColor=#000000;strokeColor=#000000;' var style = 'shape=line;fontColor=#000000;strokeColor=#000000;'
@ -518,6 +501,7 @@ class AltiumSchematicRenderer
if(chips[obj.owner_record_index] == undefined){ if(chips[obj.owner_record_index] == undefined){
chips[obj.owner_record_index] = [] chips[obj.owner_record_index] = []
} }
console.log(v11.geometry.getTerminalPoint (true))
chips[obj.owner_record_index].push(v11) chips[obj.owner_record_index].push(v11)
// v11.geometry.offset = new mxPoint(-v11.geometry.width, 2); // ctx.strokeStyle = "#000000"; // v11.geometry.offset = new mxPoint(-v11.geometry.width, 2); // ctx.strokeStyle = "#000000";
@ -532,7 +516,30 @@ class AltiumSchematicRenderer
// ctx.fill(); // 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)) { for (let obj of doc.objects.filter((o) => o instanceof AltiumLine)) {
mxCellRenderer.registerShape('polyline', mxPolyline); mxCellRenderer.registerShape('polyline', mxPolyline);
obj.x2 = 840 - obj.x2 obj.x2 = 840 - obj.x2