-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first commit Signed-off-by: ChamseddineBhd <[email protected]>
- Loading branch information
1 parent
165a305
commit aa2b435
Showing
45 changed files
with
3,203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Checkout network store sources | ||
uses: actions/checkout@v1 | ||
with: | ||
repository: powsybl/powsybl-network-store | ||
ref: refs/heads/master | ||
|
||
- name: Build and install network store client with Maven | ||
run: mvn --batch-mode -Pclient -DskipTests=true --file ../powsybl-network-store/pom.xml install | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v1 | ||
|
||
- name: Build with Maven | ||
run: mvn --batch-mode package | ||
|
||
- name: Run SonarCloud analysis | ||
run: > | ||
mvn --batch-mode -Pjacoco package sonar:sonar | ||
-Dsonar.host.url=https://sonarcloud.io | ||
-Dsonar.organization=powsybl-ci-github | ||
-Dsonar.projectKey=com.powsybl:powsybl-geo-data | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
target/ | ||
|
||
# IntelliJ | ||
/.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE module PUBLIC | ||
"-//Puppy Crawl//DTD Check Configuration 1.2//EN" | ||
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> | ||
<module name="Checker"> | ||
|
||
<module name="FileTabCharacter"/> | ||
|
||
<module name="NewlineAtEndOfFile"> | ||
<property name="lineSeparator" value="lf_cr_crlf"/> | ||
</module> | ||
|
||
<module name="RegexpSingleline"> | ||
<property name="format" value="\s+$"/> | ||
<property name="minimum" value="0"/> | ||
<property name="maximum" value="0"/> | ||
<property name="message" value="Line has trailing spaces."/> | ||
</module> | ||
|
||
<module name="Translation"/> | ||
|
||
<module name="TreeWalker"> | ||
<module name="AbbreviationAsWordInName"/> | ||
<module name="AbstractClassName"/> | ||
<module name="ArrayTypeStyle"/> | ||
<module name="ConstantName"/> | ||
<module name="EmptyCatchBlock"> | ||
<property name="exceptionVariableName" value="ignored"/> | ||
</module> | ||
<module name="EmptyLineSeparator"> | ||
<property name="allowNoEmptyLineBetweenFields" value="true"/> | ||
<property name="allowMultipleEmptyLines" value="false"/> | ||
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/> | ||
<property name="tokens" value="IMPORT, CLASS_DEF, INTERFACE_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> | ||
</module> | ||
<module name="EmptyStatement"/> | ||
<module name="EqualsHashCode"/> | ||
<module name="FinalClass"/> | ||
<module name="IllegalImport"/> | ||
<module name="Indentation"/> | ||
<module name="LeftCurly"/> | ||
<module name="LocalFinalVariableName"/> | ||
<module name="LocalVariableName"/> | ||
<module name="MemberName"/> | ||
<module name="MethodName"/> | ||
<module name="MethodParamPad"/> | ||
<module name="ModifierOrder"/> | ||
<module name="MultipleVariableDeclarations"/> | ||
<module name="MutableException"/> | ||
<module name="NeedBraces"/> | ||
<module name="NoWhitespaceAfter"/> | ||
<module name="NoWhitespaceBefore"/> | ||
<module name="OuterTypeFilename"/> | ||
<module name="ParameterAssignment"/> | ||
<module name="ParameterName"/> | ||
<module name="ParenPad"/> | ||
<module name="RedundantImport"/> | ||
<module name="RightCurly"/> | ||
<module name="SimplifyBooleanExpression"/> | ||
<module name="SimplifyBooleanReturn"/> | ||
<module name="StringLiteralEquality"/> | ||
<module name="TypecastParenPad"/> | ||
<module name="TypeName"/> | ||
<module name="UnnecessaryParentheses"/> | ||
<module name="UnusedImports"/> | ||
<module name="UpperEll"/> | ||
<module name="WhitespaceAfter"/> | ||
<module name="WhitespaceAround"> | ||
<property name="ignoreEnhancedForColon" value="false"/> | ||
</module> | ||
</module> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2019, RTE (http://www.rte-france.com) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>powsybl-geo-data</artifactId> | ||
<groupId>com.powsybl</groupId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>powsybl-geo-data-extensions</artifactId> | ||
<name>Geo data IIDM extensions</name> | ||
<description>IIDM substation and line geographical extensions</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-cgmes-conversion</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-cgmes-model</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-iidm-api</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-triple-store-api</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
</dependency> | ||
|
||
<!-- test dependencies --> | ||
<dependency> | ||
<groupId>com.google.jimfs</groupId> | ||
<artifactId>jimfs</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.xmlunit</groupId> | ||
<artifactId>xmlunit-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-commons</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-iidm-impl</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.powsybl</groupId> | ||
<artifactId>powsybl-iidm-xml-converter</artifactId> | ||
<version>${powsyblcore.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
29 changes: 29 additions & 0 deletions
29
geo-data-extensions/src/main/java/com/powsybl/geodata/extensions/Coordinate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) 2019, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.geodata.extensions; | ||
|
||
import lombok.*; | ||
|
||
/** | ||
* @author Chamseddine Benhamed <chamseddine.benhamed at rte-france.com> | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Builder | ||
public class Coordinate { | ||
|
||
private double lat; | ||
|
||
private double lon; | ||
|
||
public Coordinate(Coordinate coordinate) { | ||
this.lon = coordinate.getLon(); | ||
this.lat = coordinate.getLat(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
geo-data-extensions/src/main/java/com/powsybl/geodata/extensions/LinePosition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright (c) 2019, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.geodata.extensions; | ||
|
||
import com.powsybl.commons.extensions.AbstractExtension; | ||
import com.powsybl.iidm.network.DanglingLine; | ||
import com.powsybl.iidm.network.Identifiable; | ||
import com.powsybl.iidm.network.Line; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* | ||
* @author Massimo Ferraro <[email protected]> | ||
*/ | ||
public class LinePosition<T extends Identifiable<T>> extends AbstractExtension<T> { | ||
|
||
static final String NAME = "line-position"; | ||
|
||
private final List<Coordinate> coordinates; | ||
|
||
private LinePosition(T line, List<Coordinate> coordinates) { | ||
super(line); | ||
this.coordinates = Objects.requireNonNull(coordinates); | ||
} | ||
|
||
public LinePosition(Line line, List<Coordinate> coordinates) { | ||
this((T) line, coordinates); | ||
} | ||
|
||
public LinePosition(DanglingLine danglingLine, List<Coordinate> coordinates) { | ||
this((T) danglingLine, coordinates); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return NAME; | ||
} | ||
|
||
public List<Coordinate> getCoordinates() { | ||
return coordinates; | ||
} | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
...ta-extensions/src/main/java/com/powsybl/geodata/extensions/LinePositionXmlSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Copyright (c) 2019, RTE (http://www.rte-france.com) | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package com.powsybl.geodata.extensions; | ||
|
||
import com.google.auto.service.AutoService; | ||
import com.powsybl.commons.extensions.AbstractExtensionXmlSerializer; | ||
import com.powsybl.commons.extensions.ExtensionXmlSerializer; | ||
import com.powsybl.commons.xml.XmlReaderContext; | ||
import com.powsybl.commons.xml.XmlUtil; | ||
import com.powsybl.commons.xml.XmlWriterContext; | ||
import com.powsybl.iidm.network.DanglingLine; | ||
import com.powsybl.iidm.network.Identifiable; | ||
import com.powsybl.iidm.network.Line; | ||
|
||
import javax.xml.stream.XMLStreamException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author Massimo Ferraro <[email protected]> | ||
*/ | ||
@AutoService(ExtensionXmlSerializer.class) | ||
public class LinePositionXmlSerializer<T extends Identifiable<T>> extends AbstractExtensionXmlSerializer<T, LinePosition<T>> { | ||
|
||
public LinePositionXmlSerializer() { | ||
super(LinePosition.NAME, "network", LinePosition.class, true, "linePosition.xsd", | ||
"http://www.itesla_project.eu/schema/iidm/ext/line_position/1_0", "lp"); | ||
} | ||
|
||
@Override | ||
public void write(LinePosition<T> linePosition, XmlWriterContext context) throws XMLStreamException { | ||
for (Coordinate point : linePosition.getCoordinates()) { | ||
context.getWriter().writeEmptyElement(getNamespaceUri(), "coordinate"); | ||
XmlUtil.writeDouble("longitude", point.getLon(), context.getWriter()); | ||
XmlUtil.writeDouble("latitude", point.getLat(), context.getWriter()); | ||
} | ||
} | ||
|
||
@Override | ||
public LinePosition<T> read(T line, XmlReaderContext context) throws XMLStreamException { | ||
List<Coordinate> coordinates = new ArrayList<>(); | ||
XmlUtil.readUntilEndElement(getExtensionName(), context.getReader(), () -> { | ||
double longitude = XmlUtil.readDoubleAttribute(context.getReader(), "longitude"); | ||
double latitude = XmlUtil.readDoubleAttribute(context.getReader(), "latitude"); | ||
coordinates.add(new Coordinate(latitude, longitude)); | ||
}); | ||
return createLinePosition(line, coordinates); | ||
} | ||
|
||
private LinePosition<T> createLinePosition(T line, List<Coordinate> coordinates) { | ||
if (line instanceof Line) { | ||
return new LinePosition<>((Line) line, coordinates); | ||
} else if (line instanceof DanglingLine) { | ||
return new LinePosition<>((DanglingLine) line, coordinates); | ||
} else { | ||
throw new AssertionError("Unsupported equipment"); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.