Skip to content

Commit a4dd218

Browse files
committed
more cyclomatic complexity
1 parent cb20350 commit a4dd218

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

core/Ellipsoid.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ func (e *Ellipsoid) doShape(ps *support.ProjString) error {
318318

319319
/* Not giving a shape parameter means selecting a sphere, unless shape */
320320
/* has been selected previously via ellps=xxx */
321-
if !found && P.Es != 0 {
322-
return nil
323-
}
324-
if !found && P.Es == 0 {
321+
if !found {
322+
if P.Es != 0 {
323+
return nil
324+
}
325325
P.Es = 0
326326
P.F = 0
327327
P.B = P.A

core/System.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,9 @@ func (sys *System) processMisc() error {
473473
sys.T0 = f
474474
}
475475

476-
/* General scaling factor */
477-
if sys.ProjString.ContainsKey("k_0") {
478-
sys.K0, _ = sys.ProjString.GetAsFloat("k_0")
479-
} else if sys.ProjString.ContainsKey("k") {
480-
sys.K0, _ = sys.ProjString.GetAsFloat("k")
481-
} else {
482-
sys.K0 = 1.0
483-
}
484-
if sys.K0 <= 0.0 {
485-
return merror.New(merror.ErrKLessThanZero)
476+
err = sys.processScaling()
477+
if err != nil {
478+
return err
486479
}
487480

488481
err = sys.processUnits()
@@ -500,6 +493,23 @@ func (sys *System) processMisc() error {
500493
return nil
501494
}
502495

496+
func (sys *System) processScaling() error {
497+
498+
/* General scaling factor */
499+
if sys.ProjString.ContainsKey("k_0") {
500+
sys.K0, _ = sys.ProjString.GetAsFloat("k_0")
501+
} else if sys.ProjString.ContainsKey("k") {
502+
sys.K0, _ = sys.ProjString.GetAsFloat("k")
503+
} else {
504+
sys.K0 = 1.0
505+
}
506+
if sys.K0 <= 0.0 {
507+
return merror.New(merror.ErrKLessThanZero)
508+
}
509+
510+
return nil
511+
}
512+
503513
func (sys *System) processMeridian() error {
504514

505515
/* Prime meridian */

0 commit comments

Comments
 (0)