Skip to content

Commit

Permalink
fix arc
Browse files Browse the repository at this point in the history
  • Loading branch information
cho45 committed Aug 13, 2017
1 parent 3212073 commit a857007
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 80 deletions.
25 changes: 12 additions & 13 deletions dist/src/kicad_pcb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/kicad_pcb.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/src/kicad_pcb_plotter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/kicad_pcb_plotter.js.map

Large diffs are not rendered by default.

25 changes: 12 additions & 13 deletions src/kicad_pcb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,14 +339,14 @@ export class PCB {
}

parseBoard(): void {
console.log('parseBoard');
// console.log('parseBoard');
this.parseHeader();

for (let token = this.nextTok(); !Token.RIGHT.is(token); token = this.nextTok()) {
this.expecting(token, Token.LEFT);

token = this.nextTok();
console.log('parseBoard', token);
// console.log('parseBoard', token);

if (token.is(Token.general)) {
this.parseGeneralSection();
Expand Down Expand Up @@ -407,7 +407,7 @@ export class PCB {
let token = this.nextTok();
if (token.is(Token.version)) {
const version = this.parseInt("version");
console.log('version', version);
// console.log('version', version);
this.needRIGHT();

// (host pcbnew 4.0.2-stable)
Expand Down Expand Up @@ -936,7 +936,7 @@ export class PCB {
pad.name = this.curText();

let token = this.nextTok();
console.log('parsePad', token);
// console.log('parsePad', token);

if (token.is(Token.thru_hole)) {
pad.attribute = PadAttr.STANDARD;
Expand All @@ -956,7 +956,7 @@ export class PCB {
}

token = this.nextTok();
console.log('parsePad', token);
// console.log('parsePad', token);

if (token.is(Token.circle)) {
pad.shape = PadShape.CIRCLE;
Expand All @@ -980,7 +980,7 @@ export class PCB {
this.expecting(token, Token.LEFT);

token = this.nextTok();
console.log('parsePad', token);
// console.log('parsePad', token);

if (token.is(Token.size)) {
let width = this.parseBoardUnits("width");
Expand Down Expand Up @@ -1175,19 +1175,18 @@ export class PCB {
parseDimensionSection() {
const dimension = new Dimension();
dimension.value = this.parseBoardUnits('dimension value');
console.log('parseDimensionSection');

this.needLEFT();
let token = this.nextTok();
console.log('parseDimensionSection', token);
// console.log('parseDimensionSection', token);
this.expecting(token, Token.width);
dimension.lineWidth = this.parseBoardUnits("dimension width");
this.needRIGHT();

for (let token = this.nextTok(); !Token.RIGHT.is(token); token = this.nextTok()) {
this.expecting(token, Token.LEFT);
token = this.nextTok();
console.log('parseDimensionSection', token);
// console.log('parseDimensionSection', token);
if (token.is(Token.layer)) {
dimension.layer = this.parseBoardItemLayer("dimension layer");
this.needRIGHT();
Expand Down Expand Up @@ -1281,7 +1280,7 @@ export class PCB {
}

parseModuleSection(): Module {
console.log('parseModuleSection');
// console.log('parseModuleSection');
const mod = new Module();

this.needSYMBOLorNUMBER();
Expand All @@ -1292,7 +1291,7 @@ export class PCB {
if (token.is(Token.LEFT)) {
token = this.nextTok();
}
console.log('parseModuleSection', token);
// console.log('parseModuleSection', token);
if (token.is(Token.version)) {
const version = this.parseInt("version");
this.needRIGHT();
Expand Down Expand Up @@ -1508,7 +1507,7 @@ export class PCB {
if (token.is(Token.LEFT)) {
token = this.nextTok();
}
console.log('parseViaSection', token);
// console.log('parseViaSection', token);

if (token.is(Token.blind)) {
via.viaType = ViaType.BLIND_BURIED;
Expand Down Expand Up @@ -1575,7 +1574,7 @@ export class PCB {
if (token.is(Token.LEFT)) {
token = this.nextTok();
}
console.log('parseZoneSection', token);
// console.log('parseZoneSection', token);

if (token.is(Token.net)) {
const net = this.parseInt("net");
Expand Down
4 changes: 2 additions & 2 deletions src/kicad_pcb_plotter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export class PCBPlotter {
const radius = GetLineLength(pos, end);
const startAngle = ArcTangente( end.y - pos.y, end.x - pos.x );
const endAngle = startAngle + edge.angle;
this.thickArc( pos, -endAngle, -startAngle, radius, lineWidth, this.getPlotMode());
this.thickArc( pos, endAngle, startAngle, radius, lineWidth, this.getPlotMode());
} else
if (shape === Shape.CIRCLE) {
const radius = GetLineLength(pos, end);
Expand Down Expand Up @@ -705,7 +705,7 @@ export class PCBPlotter {
const radius = GetLineLength(end, start);
const startAngle = ArcTangente(end.y - start.y, end.x - start.x);
const endAngle = startAngle + seg.angle;
this.thickArc(start, -endAngle, -startAngle, radius, lineWidth, this.getPlotMode());
this.thickArc(start, endAngle, startAngle, radius, lineWidth, this.getPlotMode());
} else
if (seg.shape === Shape.CURVE) {
for (var i = 1, len = seg.bezierPoints.length; i < len; i++) {
Expand Down
29 changes: 14 additions & 15 deletions static/js/library.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5727,12 +5727,12 @@ var PCB = function () {
}, {
key: "parseBoard",
value: function parseBoard() {
console.log('parseBoard');
// console.log('parseBoard');
this.parseHeader();
for (var token = this.nextTok(); !kicad_pcb_token_1.Token.RIGHT.is(token); token = this.nextTok()) {
this.expecting(token, kicad_pcb_token_1.Token.LEFT);
token = this.nextTok();
console.log('parseBoard', token);
// console.log('parseBoard', token);
if (token.is(kicad_pcb_token_1.Token.general)) {
this.parseGeneralSection();
} else if (token.is(kicad_pcb_token_1.Token.page)) {
Expand Down Expand Up @@ -5775,7 +5775,7 @@ var PCB = function () {
var token = this.nextTok();
if (token.is(kicad_pcb_token_1.Token.version)) {
var version = this.parseInt("version");
console.log('version', version);
// console.log('version', version);
this.needRIGHT();
// (host pcbnew 4.0.2-stable)
this.needLEFT();
Expand Down Expand Up @@ -6269,7 +6269,7 @@ var PCB = function () {
this.needSYMBOLorNUMBER();
pad.name = this.curText();
var token = this.nextTok();
console.log('parsePad', token);
// console.log('parsePad', token);
if (token.is(kicad_pcb_token_1.Token.thru_hole)) {
pad.attribute = PadAttr.STANDARD;
} else if (token.is(kicad_pcb_token_1.Token.smd)) {
Expand All @@ -6284,7 +6284,7 @@ var PCB = function () {
this.expecting(token, kicad_pcb_token_1.Token.thru_hole, kicad_pcb_token_1.Token.smd, kicad_pcb_token_1.Token.connect, kicad_pcb_token_1.Token.np_thru_hole);
}
token = this.nextTok();
console.log('parsePad', token);
// console.log('parsePad', token);
if (token.is(kicad_pcb_token_1.Token.circle)) {
pad.shape = PadShape.CIRCLE;
} else if (token.is(kicad_pcb_token_1.Token.rect)) {
Expand All @@ -6301,7 +6301,7 @@ var PCB = function () {
for (var _token6 = this.nextTok(); !kicad_pcb_token_1.Token.RIGHT.is(_token6); _token6 = this.nextTok()) {
this.expecting(_token6, kicad_pcb_token_1.Token.LEFT);
_token6 = this.nextTok();
console.log('parsePad', _token6);
// console.log('parsePad', token);
if (_token6.is(kicad_pcb_token_1.Token.size)) {
var width = this.parseBoardUnits("width");
var height = this.parseBoardUnits("height");
Expand Down Expand Up @@ -6452,17 +6452,16 @@ var PCB = function () {
value: function parseDimensionSection() {
var dimension = new Dimension();
dimension.value = this.parseBoardUnits('dimension value');
console.log('parseDimensionSection');
this.needLEFT();
var token = this.nextTok();
console.log('parseDimensionSection', token);
// console.log('parseDimensionSection', token);
this.expecting(token, kicad_pcb_token_1.Token.width);
dimension.lineWidth = this.parseBoardUnits("dimension width");
this.needRIGHT();
for (var _token10 = this.nextTok(); !kicad_pcb_token_1.Token.RIGHT.is(_token10); _token10 = this.nextTok()) {
this.expecting(_token10, kicad_pcb_token_1.Token.LEFT);
_token10 = this.nextTok();
console.log('parseDimensionSection', _token10);
// console.log('parseDimensionSection', token);
if (_token10.is(kicad_pcb_token_1.Token.layer)) {
dimension.layer = this.parseBoardItemLayer("dimension layer");
this.needRIGHT();
Expand Down Expand Up @@ -6537,7 +6536,7 @@ var PCB = function () {
}, {
key: "parseModuleSection",
value: function parseModuleSection() {
console.log('parseModuleSection');
// console.log('parseModuleSection');
var mod = new Module();
this.needSYMBOLorNUMBER();
var name = this.curText();
Expand All @@ -6546,7 +6545,7 @@ var PCB = function () {
if (token.is(kicad_pcb_token_1.Token.LEFT)) {
token = this.nextTok();
}
console.log('parseModuleSection', token);
// console.log('parseModuleSection', token);
if (token.is(kicad_pcb_token_1.Token.version)) {
var version = this.parseInt("version");
this.needRIGHT();
Expand Down Expand Up @@ -6694,7 +6693,7 @@ var PCB = function () {
if (token.is(kicad_pcb_token_1.Token.LEFT)) {
token = this.nextTok();
}
console.log('parseViaSection', token);
// console.log('parseViaSection', token);
if (token.is(kicad_pcb_token_1.Token.blind)) {
via.viaType = ViaType.BLIND_BURIED;
} else if (token.is(kicad_pcb_token_1.Token.micro)) {
Expand Down Expand Up @@ -6742,7 +6741,7 @@ var PCB = function () {
if (token.is(kicad_pcb_token_1.Token.LEFT)) {
token = this.nextTok();
}
console.log('parseZoneSection', token);
// console.log('parseZoneSection', token);
if (token.is(kicad_pcb_token_1.Token.net)) {
var net = this.parseInt("net");
zone.netCode = this.netCodes[net];
Expand Down Expand Up @@ -15984,7 +15983,7 @@ var PCBPlotter = function () {
var radius = kicad_common_1.GetLineLength(pos, end);
var startAngle = kicad_common_1.ArcTangente(end.y - pos.y, end.x - pos.x);
var endAngle = startAngle + edge.angle;
this.thickArc(pos, -endAngle, -startAngle, radius, lineWidth, this.getPlotMode());
this.thickArc(pos, endAngle, startAngle, radius, lineWidth, this.getPlotMode());
} else if (shape === kicad_pcb_1.Shape.CIRCLE) {
var _radius = kicad_common_1.GetLineLength(pos, end);
this.thickCircle(pos, _radius * 2, lineWidth, this.getPlotMode());
Expand Down Expand Up @@ -16695,7 +16694,7 @@ var PCBPlotter = function () {
var _radius2 = kicad_common_1.GetLineLength(end, start);
var startAngle = kicad_common_1.ArcTangente(end.y - start.y, end.x - start.x);
var endAngle = startAngle + seg.angle;
this.thickArc(start, -endAngle, -startAngle, _radius2, lineWidth, this.getPlotMode());
this.thickArc(start, endAngle, startAngle, _radius2, lineWidth, this.getPlotMode());
} else if (seg.shape === kicad_pcb_1.Shape.CURVE) {
for (var i = 1, len = seg.bezierPoints.length; i < len; i++) {
this.thickSegment(seg.bezierPoints[i - 1], seg.bezierPoints[i], lineWidth, this.getPlotMode());
Expand Down
2 changes: 1 addition & 1 deletion static/js/library.bundle.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit a857007

Please sign in to comment.