Skip to content

Commit

Permalink
fixing style #22
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jan 18, 2025
1 parent 80a25cb commit 9c90c4d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/utils/geom/Triangle.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/****************************************************************************/
/****************************************************************************/
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
// This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -29,7 +29,7 @@
Triangle::Triangle() {}


Triangle::Triangle(const Position &positionA, const Position &positionB, const Position &positionC) :
Triangle::Triangle(const Position& positionA, const Position& positionB, const Position& positionC) :
myA(positionA),
myB(positionB),
myC(positionC) {
Expand All @@ -41,14 +41,14 @@ Triangle::~Triangle() {}


bool
Triangle::isAround(const Position &pos) const {
Triangle::isAround(const Position& pos) const {
if (myArea == -1) {
return false;
} else {
const double areaPAB = calculateTriangleArea2D(pos, myA, myB);
const double areaPBC = calculateTriangleArea2D(pos, myB, myC);
const double areaPCA = calculateTriangleArea2D(pos, myC, myA);
// Check if the sum of the areas matches the total area of ​​the triangle
// Check if the sum of the areas matches the total area of the triangle
return std::abs(myArea - (areaPAB + areaPBC + areaPCA)) < 1e-9;
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/netedit/attributesEnum.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class file:
saveJoinedJunctions = 11
reloadConfig = 12
reloadNetwork = 13

class neteditConfig:
menu = 14
save = 1
Expand Down
10 changes: 10 additions & 0 deletions tests/netedit/viewPositions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,29 @@ class tmp:
y = 0

# reference position


class reference:
x = 0
y = 0

# down-left position (to avoid missclicks with toolbar menus)


class downLeft:
x = 950
y = 470

# extern lane bot (common for all tests)


class externLaneBot:
x = 42
y = 332

# extern lane Top (common for all tests)


class externLaneTop:
x = 42
y = 136
Expand All @@ -50,6 +58,8 @@ class overlappedTest:
y = 218

# network


class selection:

class edge:
Expand Down
2 changes: 1 addition & 1 deletion tools/countEdgeUsage.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def writeInterval(outf, options, departCounts, arrivalCounts, intermediateCounts
arrivalStats.add(arrivalCounts[e], e)
if options.verbose:
print("Loaded %s routes" % sum(departCounts.values()))

print(departStats)
print(arrivalStats)
if options.intermediate:
Expand Down
2 changes: 1 addition & 1 deletion tools/district/filterDistricts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

"""
Filters a TAZ file for edges that exist in the given net
and optionally
and optionally
- keep edges that permit a specific vehicle class
- remove specific edge ids
Expand Down
20 changes: 10 additions & 10 deletions tools/route/geoTrip2POI.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
# @date 2025-01-16

"""
Load a file with trips define with fromLonLat / toLonLat and convert it to a poi file with POIs scaled to the relative amound of
departes/arrivals
Load a file with trips define with fromLonLat / toLonLat and convert it to a poi file
with POIs scaled to the relative amount of departs / arrivals
"""
from __future__ import absolute_import
import sys
import os
import random
import colorsys
from collections import defaultdict
sys.path.append(os.path.join(os.environ['SUMO_HOME'], 'tools'))
import sumolib
import sumolib # noqa
from sumolib.xml import parse # noqa


def parse_args(args):
USAGE = "Usage: " + sys.argv[0] + " <netfile> <routefile> [options]"
op = sumolib.options.ArgumentParser(description="convert geoTrips to POIs")
op.add_argument("routeFiles", nargs="+", category="input", type=op.file,
help="trip files to analyze")
Expand All @@ -53,25 +53,25 @@ def parse_args(args):

def main(args):
options = parse_args(args)
departLocs = defaultdict(lambda : 0)
arrivalLocs = defaultdict(lambda : 0)
departLocs = defaultdict(lambda: 0)
arrivalLocs = defaultdict(lambda: 0)

for routefile in options.routeFiles:
for trip in parse(routefile, 'trip'):
departLocs[trip.fromLonLat] += 1
arrivalLocs[trip.toLonLat] += 1

maxCount = max(
max(departLocs.values()),
max(arrivalLocs.values()))
max(departLocs.values()),
max(arrivalLocs.values()))

with open(options.outfile, 'w') as outf:
sumolib.writeXMLHeader(outf, "$Id$", root="additional", options=options) # noqa
sumolib.writeXMLHeader(outf, root="additional", options=options)
for comment, counts, rgb in (
('departures', departLocs, (1, 0, 0)),
('arrivals', arrivalLocs, (0, 0, 1))):

outf.write('<!-- %s -->\n' % comment);
outf.write('<!-- %s -->\n' % comment)
hue, sat, val = colorsys.rgb_to_hsv(*rgb)
for i, (lonLat, count) in enumerate(counts.items()):
frac = 0.2 + (count / maxCount) * 0.8
Expand Down
2 changes: 1 addition & 1 deletion tools/sumolib/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def toXML(self, precision=2, tag="statistic", indent=4, label=None, fmt=identity
description = ' description="%s"' % label if label != '' else ''

result = ' ' * indent + '<%s%s' % (tag, description)
for k,v in extraAttributes.items():
for k, v in extraAttributes.items():
result += ' %s="%s"' % (k, v)
if self.count() > 0:
result += ' count="%i"' % self.count()
Expand Down

0 comments on commit 9c90c4d

Please sign in to comment.