refactoring

This commit is contained in:
Michael Hoffer 2017-10-15 13:55:26 +02:00
parent fbe9a2ecde
commit cfebf8d21b
131 changed files with 17 additions and 17186 deletions

View File

@ -1 +0,0 @@
freerouting.freerouting

View File

@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="java_help">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/jh.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="javaws">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/javaws.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,5 +0,0 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>

View File

@ -1,487 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="4fed3cd2-709b-48f4-94e0-d0342a9f7cac" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/libraries/java_help.xml" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/libraries/javaws.xml" />
</list>
<ignored path="freerouting.freerouting.iws" />
<ignored path=".idea/workspace.xml" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="freerouting.freerouting" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="MainApplication.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/gui/MainApplication.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="153" max-vertical-offset="7106">
<caret line="36" column="25" selection-start-line="36" selection-start-column="25" selection-end-line="36" selection-end-column="25" />
<folding>
<element signature="e#0#16840#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="BoardFrame.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/gui/BoardFrame.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.37423313" vertical-offset="10935" max-vertical-offset="13175">
<caret line="690" column="21" selection-start-line="690" selection-start-column="21" selection-end-line="690" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
<FindUsagesManager>
<setting name="OPEN_NEW_TAB" value="true" />
</FindUsagesManager>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-9" />
<option name="y" value="-9" />
<option name="width" value="1698" />
<option name="height" value="1020" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="freerouting.freerouting" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="gui" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scope" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="GoToClass.includeLibraries" value="false" />
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
<property name="GoToFile.includeJavaFiles" value="false" />
<property name="MemberChooser.sorted" value="false" />
<property name="MemberChooser.showClasses" value="true" />
<property name="MemberChooser.copyJavadoc" value="false" />
<property name="recentsLimit" value="5" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/lib/javaws.jar!/" />
<property name="project.structure.last.edited" value="Libraries" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="dynamic.classpath" value="false" />
<property name="FullScreen" value="false" />
</component>
<component name="RunManager" selected="Application.MainApplication">
<configuration default="false" name="MainApplication" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="gui.MainApplication" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="freerouting.freerouting" />
<envs />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<ConfigurationWrapper RunnerId="Debug" />
<method />
</configuration>
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<method />
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="TARGET_SELECTION_MODE" value="EMULATOR" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="USE_COMMAND_LINE" value="true" />
<option name="COMMAND_LINE" value="" />
<option name="WIPE_USER_DATA" value="false" />
<option name="DISABLE_BOOT_ANIMATION" value="false" />
<option name="NETWORK_SPEED" value="full" />
<option name="NETWORK_LATENCY" value="none" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" />
<method />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="moduleWithDependencies" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android Application">
<module name="" />
<option name="ACTIVITY_CLASS" value="" />
<option name="MODE" value="default_activity" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="TARGET_SELECTION_MODE" value="EMULATOR" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<option name="USE_COMMAND_LINE" value="true" />
<option name="COMMAND_LINE" value="" />
<option name="WIPE_USER_DATA" value="false" />
<option name="DISABLE_BOOT_ANIMATION" value="false" />
<option name="NETWORK_SPEED" value="full" />
<option name="NETWORK_LATENCY" value="none" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="FILTER_LOGCAT_AUTOMATICALLY" value="true" />
<method />
</configuration>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Application.MainApplication" />
</list>
<recent_temporary>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Application.MainApplication" />
</list>
</recent_temporary>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="4fed3cd2-709b-48f4-94e0-d0342a9f7cac" name="Default" comment="" />
<created>1403984491365</created>
<updated>1403984491365</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-9" y="-9" width="1698" height="1020" extended-state="6" />
<editor active="false" />
<layout>
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32988507" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="myTodoPanelSettings">
<TodoPanelSettings />
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/gui/MainApplication.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="153" max-vertical-offset="7106">
<caret line="36" column="25" selection-start-line="36" selection-start-column="25" selection-end-line="36" selection-end-column="25" />
<folding>
<element signature="e#0#16840#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/gui/BoardFrame.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.37423313" vertical-offset="10935" max-vertical-offset="13175">
<caret line="690" column="21" selection-start-line="690" selection-start-column="21" selection-end-line="690" selection-end-column="21" />
<folding />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ArtifactsStructureConfigurable.UI">
<settings>
<artifact-editor />
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="FacetStructureConfigurable.UI">
<settings>
<last-edited>No facets are configured</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="GlobalLibrariesConfigurable.UI">
<settings>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="JdkListConfigurable.UI">
<settings>
<last-edited>1.7</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ModuleStructureConfigurable.UI">
<settings>
<last-edited>freerouting.freerouting</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
<state key="ProjectLibrariesConfigurable.UI">
<settings>
<last-edited>javaws</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

14
LICENSE
View File

@ -100,7 +100,7 @@ public, and in some countries other activities as well.
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
An eu.mihosoft.freerouting.interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
@ -227,8 +227,8 @@ terms of section 4, provided that you also meet all of these conditions:
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
d) If the work has eu.mihosoft.freerouting.interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has eu.mihosoft.freerouting.interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
@ -331,7 +331,7 @@ requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
adversely affects the operation of the network or violates the eu.mihosoft.freerouting.rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
@ -650,7 +650,7 @@ the "copyright" line and a pointer to where the full notice is found.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
notice like this when it starts in an eu.mihosoft.freerouting.interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
@ -667,8 +667,8 @@ For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
into proprietary programs. If your program is a subroutine eu.mihosoft.freerouting.library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
the eu.mihosoft.freerouting.library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -25,7 +25,7 @@ Java Based Printed Circuit Board Routing Software from FreeRouting.net written b
http://www.freerouting.net/fen/viewtopic.php?f=4&t=255
by alfons » Sat Mar 08, 2014 12:07 pm
by alfons <EFBFBD> Sat Mar 08, 2014 12:07 pm
Because I am no more maintaining the Freerouting project since 4 years and future Java versions may block my Freerouting Java Web Start application completely, I finally decided to open the source of the Freerouting project under the GNU public license version 3.
@ -37,21 +37,21 @@ Introduction:
This software can be used together with all host PCB design software systems containing a standard Specctra or Electra DSN interface. It imports .dsn-files generated by the Specctra interface of the host system and exports Specctra session files.(There exists also an interface to Cadsoft-Eagle.)
There are three modes for routing traces: 90 degree, 45 degree and free angle. The interactive router is production stable and unsurpassed in its free angle capabilities. An autorouter is currently under development and already stable in the conventional 45 degree mode.
There are three modes for routing traces: 90 degree, 45 degree and free angle. The eu.mihosoft.freerouting.interactive router is production stable and unsurpassed in its free angle capabilities. An autorouter is currently under development and already stable in the conventional 45 degree mode.
After launching the router a window appears with buttons to display some router demonstrations, to open a sample design, or to open a design of your own.
After opening a design you can start the autorouter with the button in the toolbar on top of the board window.
After opening a design you can start the autorouter with the button in the toolbar on top of the eu.mihosoft.freerouting.board window.
The board editor has three different interactive states. You can switch between this states with the buttons Select, Route and Drag on the left of the toolbar.
The eu.mihosoft.freerouting.board editor has three different eu.mihosoft.freerouting.interactive states. You can switch between this states with the buttons Select, Route and Drag on the left of the toolbar.
In the beginning the board editor is in the select state. In this state you can select single board items by picking them with the left mouse button or select items in a rectangle by dragging the left mouse button. Only item types switched on in the select parameter sheet will be selected. After selecting some items the toolbar displays options for showing and manipulating these items. If you push the info button for example a window with text information about the selected items is displayed. After clicking a blue word in this text a new window with further information pops up. To return to the select state push the cancel button or click somewhere in the empty space of the board window.
In the beginning the eu.mihosoft.freerouting.board editor is in the select state. In this state you can select single eu.mihosoft.freerouting.board items by picking them with the left mouse button or select items in a rectangle by dragging the left mouse button. Only item types switched on in the select parameter sheet will be selected. After selecting some items the toolbar displays options for showing and manipulating these items. If you push the info button for example a window with text information about the selected items is displayed. After clicking a blue word in this text a new window with further information pops up. To return to the select state push the cancel button or click somewhere in the empty space of the eu.mihosoft.freerouting.board window.
By pushing the Route button you get into the state for interactive routing. In this state you can start a new trace by picking an item belonging to a net, for example a pin. Then you can follow the displayed airline with the mouse until you have reached the target item at the other end of the airline. The trace will be connected automatically to the target, if it is on the same layer. If you want to change to a different layer during interactive routing, select "change layer" and then the name of the new layer in the popup menu under the right mouse button. Then a via will be inserted, if that is possible, and a new trace starts on the new layer. You can also change the layer by pressing a number key.
By pushing the Route button you get into the state for eu.mihosoft.freerouting.interactive routing. In this state you can start a new trace by picking an item belonging to a net, for example a pin. Then you can follow the displayed airline with the mouse until you have reached the target item at the other end of the airline. The trace will be connected automatically to the target, if it is on the same layer. If you want to change to a different layer during eu.mihosoft.freerouting.interactive routing, select "change layer" and then the name of the new layer in the popup menu under the right mouse button. Then a via will be inserted, if that is possible, and a new trace starts on the new layer. You can also change the layer by pressing a number key.
After pushing the Drag button you get into the state for changing the location of vias, components or traces. In this state you can select vias or components and drag them with the left mouse button to a different location. The connected route is updated automatically. You can also move traces by pushing them from behind out of the empty space with the left mouse button pressed. That works on the current layer, which can be changed in the select parameter sheet. In this way you can make space for example to insert a new component.
For more information please use the online help in the board editor. From here you can download also a printable version of the online help.
For more information please use the online help in the eu.mihosoft.freerouting.board editor. From here you can download also a printable version of the online help.
If you have further questions or want some feedback, please sent an Email to support@ FreeRouting.net or visit our forum.
@ -84,7 +84,7 @@ Here are some instructions how to run the Freerouting project in the NetBeans ID
5) Build your new project in NetBeans.
6) To get rid of the undefined's download and unzip the attached library jh.jar. It is the system library of the Java Help system.
6) To get rid of the undefined's download and unzip the attached eu.mihosoft.freerouting.library jh.jar. It is the system eu.mihosoft.freerouting.library of the Java Help system.
7) Right click on the name of your new project on the left of NetBeans and select Properties.
@ -94,6 +94,6 @@ Here are some instructions how to run the Freerouting project in the NetBeans ID
10) Build the project again. The router should run now.
For optional parameters of the Freerouting outfile check the usage of the variable p_args in the source file gui/MainApplication.java.
For optional parameters of the Freerouting outfile check the usage of the variable p_args in the source file eu.mihosoft.freerouting.gui/MainApplication.java.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<headerType>eu.mihosoft.freerouting.gui</headerType>
<jar>F:\stuff\freerouting.freerouting\build\FreeRouting.jar</jar>
<outfile>FreeRouting.exe</outfile>
<errTitle></errTitle>

Binary file not shown.

View File

@ -1,324 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* AutorouteSettings.java
*
* Created on 1. Maerz 2007, 07:10
*
*/
package designformats.specctra;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
*
* @author Alfons Wirtz
*/
public class AutorouteSettings
{
static interactive.AutorouteSettings read_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
interactive.AutorouteSettings result = new interactive.AutorouteSettings(p_layer_structure.arr.length);
boolean with_fanout = false;
boolean with_autoroute = true;
boolean with_postroute = true;
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
} catch (java.io.IOException e)
{
System.out.println("AutorouteSettings.read_scope: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("AutorouteSettings.read_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.FANOUT)
{
with_fanout = DsnFile.read_on_off_scope(p_scanner);
}
else if (next_token == Keyword.AUTOROUTE)
{
with_autoroute = DsnFile.read_on_off_scope(p_scanner);
}
else if (next_token == Keyword.POSTROUTE)
{
with_postroute = DsnFile.read_on_off_scope(p_scanner);
}
else if (next_token == Keyword.VIAS)
{
result.set_vias_allowed(DsnFile.read_on_off_scope(p_scanner));
}
else if (next_token == Keyword.VIA_COSTS)
{
result.set_via_costs(DsnFile.read_integer_scope(p_scanner));
}
else if (next_token == Keyword.PLANE_VIA_COSTS)
{
result.set_plane_via_costs(DsnFile.read_integer_scope(p_scanner));
}
else if (next_token == Keyword.START_RIPUP_COSTS)
{
result.set_start_ripup_costs(DsnFile.read_integer_scope(p_scanner));
}
else if (next_token == Keyword.START_PASS_NO)
{
result.set_pass_no(DsnFile.read_integer_scope(p_scanner));
}
else if (next_token == Keyword.LAYER_RULE)
{
result = read_layer_rule(p_scanner, p_layer_structure, result);
if (result == null)
{
return null;
}
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
}
result.set_with_fanout(with_fanout);
result.set_with_autoroute(with_autoroute);
result.set_with_postroute(with_postroute);
return result;
}
static interactive.AutorouteSettings read_layer_rule(Scanner p_scanner, LayerStructure p_layer_structure,
interactive.AutorouteSettings p_settings)
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token;
try
{
next_token = p_scanner.next_token();
} catch (java.io.IOException e)
{
System.out.println("AutorouteSettings.read_layer_rule: IO error scanning file");
return null;
}
if (!(next_token instanceof String))
{
System.out.println("AutorouteSettings.read_layer_rule: String expected");
return null;
}
int layer_no = p_layer_structure.get_no((String) next_token);
if (layer_no < 0)
{
System.out.println("AutorouteSettings.read_layer_rule: layer not found");
return null;
}
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
} catch (java.io.IOException e)
{
System.out.println("AutorouteSettings.read_layer_rule: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("AutorouteSettings.read_layer_rule: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.ACTIVE)
{
p_settings.set_layer_active(layer_no, DsnFile.read_on_off_scope(p_scanner));
}
else if (next_token == Keyword.PREFERRED_DIRECTION)
{
try
{
boolean pref_dir_is_horizontal = true;
next_token = p_scanner.next_token();
if (next_token == Keyword.VERTICAL)
{
pref_dir_is_horizontal = false;
}
else if (next_token != Keyword.HORIZONTAL)
{
System.out.println("AutorouteSettings.read_layer_rule: unexpected key word");
return null;
}
p_settings.set_preferred_direction_is_horizontal(layer_no, pref_dir_is_horizontal);
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("AutorouteSettings.read_layer_rule: uclosing bracket expected");
return null;
}
} catch (java.io.IOException e)
{
System.out.println("AutorouteSettings.read_layer_rule: IO error scanning file");
return null;
}
}
else if (next_token == Keyword.PREFERRED_DIRECTION_TRACE_COSTS)
{
p_settings.set_preferred_direction_trace_costs(layer_no, DsnFile.read_float_scope(p_scanner));
}
else if (next_token == Keyword.AGAINST_PREFERRED_DIRECTION_TRACE_COSTS)
{
p_settings.set_against_preferred_direction_trace_costs(layer_no, DsnFile.read_float_scope(p_scanner));
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
}
return p_settings;
}
static void write_scope(IndentFileWriter p_file, interactive.AutorouteSettings p_settings,
board.LayerStructure p_layer_structure, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.start_scope();
p_file.write("autoroute_settings");
p_file.new_line();
p_file.write("(fanout ");
if (p_settings.get_with_fanout())
{
p_file.write("on)");
}
else
{
p_file.write("off)");
}
p_file.new_line();
p_file.write("(autoroute ");
if (p_settings.get_with_autoroute())
{
p_file.write("on)");
}
else
{
p_file.write("off)");
}
p_file.new_line();
p_file.write("(postroute ");
if (p_settings.get_with_postroute())
{
p_file.write("on)");
}
else
{
p_file.write("off)");
}
p_file.new_line();
p_file.write("(vias ");
if (p_settings.get_vias_allowed())
{
p_file.write("on)");
}
else
{
p_file.write("off)");
}
p_file.new_line();
p_file.write("(via_costs ");
{
Integer via_costs = p_settings.get_via_costs();
p_file.write(via_costs.toString());
}
p_file.write(")");
p_file.new_line();
p_file.write("(plane_via_costs ");
{
Integer via_costs = p_settings.get_plane_via_costs();
p_file.write(via_costs.toString());
}
p_file.write(")");
p_file.new_line();
p_file.write("(start_ripup_costs ");
{
Integer ripup_costs = p_settings.get_start_ripup_costs();
p_file.write(ripup_costs.toString());
}
p_file.write(")");
p_file.new_line();
p_file.write("(start_pass_no ");
{
Integer pass_no = p_settings.get_pass_no();
p_file.write(pass_no.toString());
}
p_file.write(")");
for (int i = 0; i < p_layer_structure.arr.length; ++i)
{
board.Layer curr_layer = p_layer_structure.arr[i];
p_file.start_scope();
p_file.write("layer_rule ");
p_identifier_type.write(curr_layer.name, p_file);
p_file.new_line();
p_file.write("(active ");
if (p_settings.get_layer_active(i))
{
p_file.write("on)");
}
else
{
p_file.write("off)");
}
p_file.new_line();
p_file.write("(preferred_direction ");
if (p_settings.get_preferred_direction_is_horizontal(i))
{
p_file.write("horizontal)");
}
else
{
p_file.write("vertical)");
}
p_file.new_line();
p_file.write("(preferred_direction_trace_costs ");
Float trace_costs = (float) p_settings.get_preferred_direction_trace_costs(i);
p_file.write(trace_costs.toString());
p_file.write(")");
p_file.new_line();
p_file.write("(against_preferred_direction_trace_costs ");
trace_costs = (float) p_settings.get_against_preferred_direction_trace_costs(i);
p_file.write(trace_costs.toString());
p_file.write(")");
p_file.end_scope();
}
p_file.end_scope();
}
}

View File

@ -1,115 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Circle.java
*
* Created on 20. Mai 2004, 09:22
*/
package designformats.specctra;
import geometry.planar.IntPoint;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Class for reading and writing circle scopes from dsn-files.
*
* @author alfons
*/
public class Circle extends Shape
{
/**
* Creates a new circle from the input parameters.
* p_coor is an array of dimension 3.
* p_coor [0] is the radius of the circle,
* p_coor [1] is the x coordinate of the circle,
* p_coor [2] is the y coordinate of the circle.
*/
public Circle(Layer p_layer, double [] p_coor)
{
super(p_layer);
coor = p_coor;
}
public Circle(Layer p_layer, double p_radius, double p_center_x, double p_center_y)
{
super(p_layer);
coor = new double[3];
coor[0] = p_radius;
coor[1] = p_center_x;
coor[2] = p_center_y;
}
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
double [] location = new double[2];
location[0] = coor[1];
location[1] = coor[2];
IntPoint center = p_coordinate_transform.dsn_to_board(location).round();
int radius = (int) Math.round(p_coordinate_transform.dsn_to_board(coor[0]) / 2);
return new geometry.planar.Circle(center, radius);
}
public geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform)
{
int [] new_coor = new int[3];
new_coor[0] = (int) Math.round(p_coordinate_transform.dsn_to_board(coor[0]) / 2);
for (int i = 1; i < 3; ++i)
{
new_coor[i] = (int) Math.round(p_coordinate_transform.dsn_to_board(coor[i]));
}
return new geometry.planar.Circle(new IntPoint(new_coor[1], new_coor[2]), new_coor[0]);
}
public Rectangle bounding_box()
{
double[] bounds = new double[4];
bounds[0] = coor[1] - coor[0];
bounds[1] = coor[2] - coor[0];
bounds[2] = coor[1] + coor[0];
bounds[3] = coor[2] + coor[0];
return new Rectangle(layer, bounds);
}
public void write_scope(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.new_line();
p_file.write("(circle ");
p_identifier_type.write(this.layer.name, p_file);
for (int i = 0; i < coor.length; ++i)
{
p_file.write(" ");
p_file.write(new Double(coor[i]).toString());
}
p_file.write(")");
}
public void write_scope_int(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.new_line();
p_file.write("(circle ");
p_identifier_type.write(this.layer.name, p_file);
for (int i = 0; i < coor.length; ++i)
{
p_file.write(" ");
Integer curr_coor = (int) Math.round(coor[i]);
p_file.write(curr_coor.toString());
}
p_file.write(")");
}
public final double[] coor;
}

View File

@ -1,181 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Circuit.java
*
* Created on 30. Mai 2005, 06:30
*
*/
package designformats.specctra;
/**
*
* @author Alfons Wirtz
*/
public class Circuit
{
/**
* Currently only the length matching rule is read from a circuit scope.
* If the scope does not contain a length matching rule, nulll is returned.
*/
public static ReadScopeResult read_scope( Scanner p_scanner)
{
Object next_token = null;
double min_trace_length = 0;
double max_trace_length = 0;
java.util.Collection<String> use_via = new java.util.LinkedList<String>();
java.util.Collection<String> use_layer = new java.util.LinkedList<String>();
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Circuit.read_scope: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("Circuit.read_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.LENGTH)
{
LengthMatchingRule length_rule = read_length_scope(p_scanner);
if (length_rule != null)
{
min_trace_length = length_rule.min_length;
max_trace_length = length_rule.max_length;
}
}
else if (next_token == Keyword.USE_VIA)
{
use_via.addAll(Structure.read_via_padstacks(p_scanner));
}
else if (next_token == Keyword.USE_LAYER)
{
use_layer.addAll(DsnFile.read_string_list_scope(p_scanner));
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
}
return new ReadScopeResult(max_trace_length, min_trace_length, use_via, use_layer);
}
static LengthMatchingRule read_length_scope( Scanner p_scanner)
{
LengthMatchingRule result = null;
double[] length_arr = new double[2];
Object next_token = null;
for (int i = 0; i < 2; ++i)
{
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Circuit.read_length_scope: IO error scanning file");
return null;
}
if (next_token instanceof Double)
{
length_arr[i] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
length_arr[i] = ((Integer) next_token).intValue();
}
else
{
System.out.println("Circuit.read_length_scope: number expected");
return null;
}
}
result = new LengthMatchingRule(length_arr[0], length_arr[1]);
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Circuit.read_length_scope: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("Circuit.read_length_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
ScopeKeyword.skip_scope(p_scanner);
}
}
return result;
}
/** A max_length of -1 indicates, tha no maximum length is defined. */
public static class ReadScopeResult
{
public ReadScopeResult(double p_max_length, double p_min_length, java.util.Collection<String> p_use_via, java.util.Collection<String> p_use_layer)
{
max_length = p_max_length;
min_length = p_min_length;
use_via = p_use_via;
use_layer = p_use_layer;
}
public final double max_length;
public final double min_length;
public final java.util.Collection<String> use_via;
public final java.util.Collection<String> use_layer;
}
/** A max_length of -1 indicates, tha no maximum length is defined. */
private static class LengthMatchingRule
{
public LengthMatchingRule(double p_max_length, double p_min_length)
{
max_length = p_max_length;
min_length = p_min_length;
}
public final double max_length;
public final double min_length;
}
}

View File

@ -1,430 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Component.java
*
* Created on 20. Mai 2004, 07:32
*/
package designformats.specctra;
/**
* Handels the placement bata of a library component.
*
* @author alfons
*/
public class Component extends ScopeKeyword
{
/** Creates a new instance of Component */
public Component()
{
super("component");
}
/**
* Overwrites the function read_scope in ScopeKeyword
*/
public boolean read_scope(ReadScopeParameter p_par)
{
try
{
ComponentPlacement component_placement = read_scope(p_par.scanner);
if(component_placement == null)
{
return false;
}
p_par.placement_list.add(component_placement);
}
catch (java.io.IOException e)
{
System.out.println("Component.read_scope: IO error scanning file");
return false;
}
return true;
}
/**
* Used also when reading a session file.
*/
public static ComponentPlacement read_scope(Scanner p_scanner) throws java.io.IOException
{
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Component.read_scope: component name expected");
return null;
}
String name = (String) next_token;
ComponentPlacement component_placement = new ComponentPlacement(name);
Object prev_token = next_token;
next_token = p_scanner.next_token();
while ( next_token != Keyword.CLOSED_BRACKET)
{
if (prev_token == Keyword.OPEN_BRACKET && next_token == Keyword.PLACE)
{
ComponentPlacement.ComponentLocation next_location = read_place_scope(p_scanner);
if (next_location != null)
{
component_placement.locations.add(next_location);
}
}
prev_token = next_token;
next_token = p_scanner.next_token();
}
return component_placement;
}
public static void write_scope(WriteScopeParameter p_par, board.Component p_component)
throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("place ");
p_par.file.new_line();
p_par.identifier_type.write(p_component.name, p_par.file);
if (p_component.is_placed())
{
double [] coor = p_par.coordinate_transform.board_to_dsn(p_component.get_location().to_float());
for (int i = 0; i < coor.length; ++i)
{
p_par.file.write(" ");
p_par.file.write((new Double(coor[i])).toString());
}
if (p_component.placed_on_front())
{
p_par.file.write(" front ");
}
else
{
p_par.file.write(" back ");
}
int rotation = (int) Math.round(p_component.get_rotation_in_degree());
p_par.file.write((new Integer(rotation).toString()));
}
if (p_component.position_fixed)
{
p_par.file.new_line();
p_par.file.write(" (lock_type position)");
}
int pin_count = p_component.get_package().pin_count();
for (int i = 0; i < pin_count; ++i)
{
write_pin_info(p_par, p_component, i);
}
write_keepout_infos(p_par, p_component);
p_par.file.end_scope();
}
private static void write_pin_info(WriteScopeParameter p_par, board.Component p_component, int p_pin_no)
throws java.io.IOException
{
if (!p_component.is_placed())
{
return;
}
library.Package.Pin package_pin = p_component.get_package().get_pin(p_pin_no);
if (package_pin == null)
{
System.out.println("Component.write_pin_info: package pin not found");
return;
}
board.Pin component_pin = p_par.board.get_pin(p_component.no, p_pin_no);
if (component_pin == null)
{
System.out.println("Component.write_pin_info: component pin not found");
return;
}
String cl_class_name = p_par.board.rules.clearance_matrix.get_name(component_pin.clearance_class_no());
if (cl_class_name == null)
{
System.out.println("Component.write_pin_info: clearance class name not found");
return;
}
p_par.file.new_line();
p_par.file.write("(pin ");
p_par.identifier_type.write(package_pin.name, p_par.file);
p_par.file.write(" (clearance_class ");
p_par.identifier_type.write(cl_class_name, p_par.file);
p_par.file.write("))");
}
private static void write_keepout_infos(WriteScopeParameter p_par, board.Component p_component)
throws java.io.IOException
{
if (!p_component.is_placed())
{
return;
}
library.Package.Keepout[] curr_keepout_arr;
String keepout_type;
for (int j = 0; j < 3; ++j)
{
if (j == 0)
{
curr_keepout_arr = p_component.get_package().keepout_arr;
keepout_type = "(keepout ";
}
else if (j == 1)
{
curr_keepout_arr = p_component.get_package().via_keepout_arr;
keepout_type = "(via_keepout ";
}
else
{
curr_keepout_arr = p_component.get_package().place_keepout_arr;
keepout_type = "(place_keepout ";
}
for (int i = 0; i < curr_keepout_arr.length; ++i)
{
library.Package.Keepout curr_keepout = curr_keepout_arr[i];
board.ObstacleArea curr_obstacle_area = get_keepout(p_par.board, p_component.no, curr_keepout.name);
if (curr_obstacle_area == null || curr_obstacle_area.clearance_class_no() == 0)
{
continue;
}
String cl_class_name = p_par.board.rules.clearance_matrix.get_name(curr_obstacle_area.clearance_class_no());
if (cl_class_name == null)
{
System.out.println("Component.write_keepout_infos: clearance class name not found");
return;
}
p_par.file.new_line();
p_par.file.write(keepout_type);
p_par.identifier_type.write(curr_keepout.name, p_par.file);
p_par.file.write(" (clearance_class ");
p_par.identifier_type.write(cl_class_name, p_par.file);
p_par.file.write("))");
}
}
}
private static board.ObstacleArea get_keepout(board.BasicBoard p_board, int p_component_no, String p_name)
{
java.util.Iterator<datastructures.UndoableObjects.UndoableObjectNode> it = p_board.item_list.start_read_object();
for(;;)
{
board.Item curr_item = (board.Item)p_board.item_list.read_object(it);
if (curr_item == null)
{
break;
}
if (curr_item.get_component_no() == p_component_no && curr_item instanceof board.ObstacleArea)
{
board.ObstacleArea curr_area = (board.ObstacleArea) curr_item;
if (curr_area.name != null && curr_area.name.equals(p_name))
{
return curr_area;
}
}
}
return null;
}
private static ComponentPlacement.ComponentLocation read_place_scope(Scanner p_scanner)
{
try
{
java.util.Map <String, ComponentPlacement.ItemClearanceInfo> pin_infos =
new java.util.TreeMap<String, ComponentPlacement.ItemClearanceInfo>();
java.util.Map <String, ComponentPlacement.ItemClearanceInfo> keepout_infos =
new java.util.TreeMap<String, ComponentPlacement.ItemClearanceInfo>();
java.util.Map <String, ComponentPlacement.ItemClearanceInfo> via_keepout_infos =
new java.util.TreeMap<String, ComponentPlacement.ItemClearanceInfo>();
java.util.Map <String, ComponentPlacement.ItemClearanceInfo> place_keepout_infos =
new java.util.TreeMap<String, ComponentPlacement.ItemClearanceInfo>();
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Component.read_place_scope: String expected");
return null;
}
String name = (String) next_token;
double[] location = new double[2];
for (int i = 0; i < 2; ++i)
{
next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
location[i] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
location[i] = ((Integer) next_token).intValue();
}
else if (next_token == Keyword.CLOSED_BRACKET)
{
// component is not yet placed
return new ComponentPlacement.ComponentLocation(name, null, true, 0, false, pin_infos,
keepout_infos, via_keepout_infos, place_keepout_infos);
}
else
{
System.out.println("Component.read_place_scope: number expected");
return null;
}
}
next_token = p_scanner.next_token();
boolean is_front = true;
if (next_token == Keyword.BACK)
{
is_front = false;
}
else if (next_token != Keyword.FRONT)
{
System.out.println("Component.read_place_scope: Keyword.FRONT expected");
}
double rotation;
next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
rotation = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
rotation = ((Integer) next_token).intValue();
}
else
{
System.out.println("Component.read_place_scope: number expected");
return null;
}
boolean position_fixed = false;
next_token = p_scanner.next_token();
while (next_token == Keyword.OPEN_BRACKET)
{
next_token = p_scanner.next_token();
if (next_token == Keyword.LOCK_TYPE)
{
position_fixed = read_lock_type(p_scanner);
}
else if (next_token == Keyword.PIN)
{
ComponentPlacement.ItemClearanceInfo curr_pin_info = read_item_clearance_info(p_scanner);
if (curr_pin_info == null)
{
return null;
}
pin_infos.put(curr_pin_info.name, curr_pin_info);
}
else if (next_token == Keyword.KEEPOUT)
{
ComponentPlacement.ItemClearanceInfo curr_keepout_info = read_item_clearance_info(p_scanner);
if (curr_keepout_info == null)
{
return null;
}
keepout_infos.put(curr_keepout_info.name, curr_keepout_info);
}
else if (next_token == Keyword.VIA_KEEPOUT)
{
ComponentPlacement.ItemClearanceInfo curr_keepout_info = read_item_clearance_info(p_scanner);
if (curr_keepout_info == null)
{
return null;
}
via_keepout_infos.put(curr_keepout_info.name, curr_keepout_info);
}
else if (next_token == Keyword.PLACE_KEEPOUT)
{
ComponentPlacement.ItemClearanceInfo curr_keepout_info = read_item_clearance_info(p_scanner);
if (curr_keepout_info == null)
{
return null;
}
place_keepout_infos.put(curr_keepout_info.name, curr_keepout_info);
}
else
{
skip_scope(p_scanner);
}
next_token = p_scanner.next_token();
}
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Component.read_place_scope: ) expected");
return null;
}
ComponentPlacement.ComponentLocation result =
new ComponentPlacement.ComponentLocation(name, location, is_front, rotation, position_fixed, pin_infos,
keepout_infos, via_keepout_infos, place_keepout_infos);
return result;
}
catch (java.io.IOException e)
{
System.out.println("Component.read_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
private static ComponentPlacement.ItemClearanceInfo read_item_clearance_info(Scanner p_scanner) throws java.io.IOException
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Component.read_item_clearance_info: String expected");
return null;
}
String name = (String) next_token;
String cl_class_name = null;
next_token = p_scanner.next_token();
while (next_token == Keyword.OPEN_BRACKET)
{
next_token = p_scanner.next_token();
if (next_token == Keyword.CLEARANCE_CLASS)
{
cl_class_name = DsnFile.read_string_scope(p_scanner);
}
else
{
skip_scope(p_scanner);
}
next_token = p_scanner.next_token();
}
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Component.read_item_clearance_info: ) expected");
return null;
}
if (cl_class_name == null)
{
System.out.println("Component.read_item_clearance_info: clearance class name not found");
return null;
}
return new ComponentPlacement.ItemClearanceInfo(name, cl_class_name);
}
private static boolean read_lock_type(Scanner p_scanner) throws java.io.IOException
{
boolean result = false;
for (;;)
{
Object next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
if (next_token == Keyword.POSITION)
{
result = true;
}
}
return result;
}
}

View File

@ -1,106 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* ComponentPlacement.java
*
* Created on 20. Mai 2004, 07:43
*/
package designformats.specctra;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Map;
/**
* Describes the placement data of a library component
*
* @author alfons
*/
public class ComponentPlacement
{
/** Creates a new instance of ComponentPlacement */
public ComponentPlacement(String p_lib_name)
{
lib_name = p_lib_name;
locations = new LinkedList<ComponentLocation>();
}
/** The name of the corresponding library component */
public final String lib_name;
/** The list of ComponentLocations of the library component on the board. */
public final Collection<ComponentLocation> locations;
/** The structure of an entry in the list locations. */
public static class ComponentLocation
{
ComponentLocation(String p_name, double[] p_coor, boolean p_is_front, double p_rotation, boolean p_position_fixed,
Map<String, ItemClearanceInfo> p_pin_infos, Map<String, ItemClearanceInfo> p_keepout_infos,
Map<String, ItemClearanceInfo> p_via_keepout_infos, Map<String, ItemClearanceInfo> p_place_keepout_infos)
{
name = p_name;
coor = p_coor;
is_front = p_is_front;
rotation = p_rotation;
position_fixed = p_position_fixed;
pin_infos = p_pin_infos;
keepout_infos = p_keepout_infos;
via_keepout_infos = p_via_keepout_infos;
place_keepout_infos = p_place_keepout_infos;
}
public final String name;
/** the x- and the y-coordinate of the location. */
public final double [] coor;
/**
* True, if the component is placed at the component side.
* Else the component is placed at the solder side.
*/
public final boolean is_front;
/** The rotation of the component in degree. */
public final double rotation;
/** If true, the component cannot be moved. */
public final boolean position_fixed;
/**
* The entries of this map are of type ItemClearanceInfo, the keys are the pin names.
*/
public final Map<String, ItemClearanceInfo> pin_infos;
public final Map<String, ItemClearanceInfo> keepout_infos;
public final Map<String, ItemClearanceInfo> via_keepout_infos;
public final Map<String, ItemClearanceInfo> place_keepout_infos;
}
public static class ItemClearanceInfo
{
ItemClearanceInfo( String p_name, String p_clearance_class)
{
name = p_name;
clearance_class = p_clearance_class;
}
public final String name;
public final String clearance_class;
}
}

View File

@ -1,262 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* CoordinateTransform.java
*
* Created on 14. Mai 2004, 09:09
*/
package designformats.specctra;
import geometry.planar.FloatPoint;
import geometry.planar.Vector;
import geometry.planar.Line;
import geometry.planar.IntBox;
import geometry.planar.PolylineShape;
/**
* Computes transformations between a specctra dsn-file coordinates and board coordinates.
*
* @author Alfons Wirtz
*/
public class CoordinateTransform implements java.io.Serializable
{
/**
* Creates a new instance of CoordinateTransform.
* The base point of the dsn coordinate system will be translated to zero in the board
* coordinate system.
*/
public CoordinateTransform(double p_scale_factor, double p_base_x, double p_base_y)
{
scale_factor = p_scale_factor;
base_x = p_base_x;
base_y = p_base_y;
}
/**
* Scale a value from the board to the dsn coordinate system
*/
public double board_to_dsn(double p_val)
{
return p_val / scale_factor;
}
/**
* Scale a value from the dsn to the board coordinate system
*/
public double dsn_to_board(double p_val)
{
return p_val * scale_factor;
}
/**
* Transforms a geometry.planar.FloatPoint to a tuple of doubles
* in the dsn coordinate system.
*/
public double[] board_to_dsn(FloatPoint p_point)
{
double [] result = new double[2];
result [0] = board_to_dsn(p_point.x) + base_x;
result [1] = board_to_dsn(p_point.y) + base_y;
return result;
}
/**
* Transforms a geometry.planar.FloatPoint to a tuple of doubles
* in the dsn coordinate system in relative (vector) coordinates.
*/
public double[] board_to_dsn_rel(FloatPoint p_point)
{
double [] result = new double[2];
result [0] = board_to_dsn(p_point.x);
result [1] = board_to_dsn(p_point.y);
return result;
}
/**
* Transforms an array of n geometry.planar.FloatPoints to
* an array of 2*n doubles in the dsn coordinate system.
*/
public double [] board_to_dsn(FloatPoint [] p_points)
{
double [] result = new double[2 * p_points.length];
for (int i = 0; i < p_points.length; ++ i)
{
result[2 * i] = board_to_dsn(p_points[i].x) + base_x;
result[2 * i + 1] = board_to_dsn(p_points[i].y) + base_y;
}
return result;
}
/**
* Transforms an array of n geometry.planar.Lines to
* an array of 4*n doubles in the dsn coordinate system.
*/
public double [] board_to_dsn(Line [] p_lines)
{
double [] result = new double[4 * p_lines.length];
for (int i = 0; i < p_lines.length; ++ i)
{
FloatPoint a = p_lines[i].a.to_float();
FloatPoint b = p_lines[i].b.to_float();
result[4 * i] = board_to_dsn(a.x) + base_x;
result[4 * i + 1] = board_to_dsn(a.y) + base_y;
result[4 * i + 2] = board_to_dsn(b.x) + base_x;
result[4 * i + 3] = board_to_dsn(b.y) + base_y;
}
return result;
}
/**
* Transforms an array of n geometry.planar.FloatPoints to
* an array of 2*n doubles in the dsn coordinate system in relative (vector) coordinates.
*/
public double [] board_to_dsn_rel(FloatPoint [] p_points)
{
double [] result = new double[2 * p_points.length];
for (int i = 0; i < p_points.length; ++ i)
{
result[2 * i] = board_to_dsn(p_points[i].x);
result[2 * i + 1] = board_to_dsn(p_points[i].y);
}
return result;
}
/**
* Transforms a geometry.planar.Vector to a tuple of doubles
* in the dsn coordinate system.
*/
public double[] board_to_dsn(Vector p_vector)
{
double [] result = new double[2];
FloatPoint v = p_vector.to_float();
result [0] = board_to_dsn(v.x);
result [1] = board_to_dsn(v.y);
return result;
}
/**
* Transforms a dsn tuple to a geometry.planar.FloatPoint
*/
public FloatPoint dsn_to_board(double [] p_tuple)
{
double x = dsn_to_board(p_tuple[0] - base_x);
double y = dsn_to_board(p_tuple[1] - base_y);
return new FloatPoint(x, y);
}
/**
* Transforms a dsn tuple to a geometry.planar.FloatPoint in relative (vector) coordinates.
*/
public FloatPoint dsn_to_board_rel(double [] p_tuple)
{
double x = dsn_to_board(p_tuple[0]);
double y = dsn_to_board(p_tuple[1]);
return new FloatPoint(x, y);
}
/**
* Transforms a geometry.planar.Intbox to the coordinates of a Rectangle.
*/
public double [] board_to_dsn(IntBox p_box)
{
double [] result = new double[4];
result[0] = p_box.ll.x / scale_factor + base_x;
result[1] = p_box.ll.y / scale_factor + base_y;
result[2] = p_box.ur.x / scale_factor + base_x;
result[3] = p_box.ur.y / scale_factor + base_y;
return result;
}
/**
* Transforms a geometry.planar.Intbox to a Rectangle in relative (vector) coordinates.
*/
public double [] board_to_dsn_rel(IntBox p_box)
{
double [] result = new double[4];
result[0] = p_box.ll.x / scale_factor;
result[1] = p_box.ll.y / scale_factor ;
result[2] = p_box.ur.x / scale_factor;
result[3] = p_box.ur.y / scale_factor;
return result;
}
/**
* Transforms a board shape to a dsn shape.
*/
public Shape board_to_dsn(geometry.planar.Shape p_board_shape, Layer p_layer)
{
Shape result;
if (p_board_shape instanceof IntBox)
{
result = new Rectangle(p_layer, board_to_dsn((IntBox) p_board_shape));
}
else if (p_board_shape instanceof PolylineShape)
{
FloatPoint [] corners = ((PolylineShape)p_board_shape).corner_approx_arr();
double [] coors = board_to_dsn(corners);
result = new Polygon(p_layer, coors);
}
else if (p_board_shape instanceof geometry.planar.Circle)
{
geometry.planar.Circle board_circle = (geometry.planar.Circle) p_board_shape;
double diameter = 2 * board_to_dsn(board_circle.radius);
double [] center_coor = board_to_dsn(board_circle.center.to_float());
result = new Circle(p_layer, diameter, center_coor[0], center_coor[1]);
}
else
{
System.out.println("CoordinateTransform.board_to_dsn not yet implemented for p_board_shape");
result = null;
}
return result;
}
/**
* Transforms the relative (vector) coordinates of a geometry.planar.Shape to a specctra dsn shape.
*/
public Shape board_to_dsn_rel(geometry.planar.Shape p_board_shape, Layer p_layer)
{
Shape result;
if (p_board_shape instanceof IntBox)
{
result = new Rectangle(p_layer, board_to_dsn_rel((IntBox) p_board_shape));
}
else if (p_board_shape instanceof PolylineShape)
{
FloatPoint [] corners = ((PolylineShape)p_board_shape).corner_approx_arr();
double [] coors = board_to_dsn_rel(corners);
result = new Polygon(p_layer, coors);
}
else if (p_board_shape instanceof geometry.planar.Circle)
{
geometry.planar.Circle board_circle = (geometry.planar.Circle) p_board_shape;
double diameter = 2 * board_to_dsn(board_circle.radius);
double [] center_coor = board_to_dsn_rel(board_circle.center.to_float());
result = new Circle(p_layer, diameter, center_coor[0], center_coor[1]);
}
else
{
System.out.println("CoordinateTransform.board_to_dsn not yet implemented for p_board_shape");
result = null;
}
return result;
}
private final double scale_factor;
private final double base_x;
private final double base_y;
}

View File

@ -1,430 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* InputDsnFile.java
*
* Created on 10. Mai 2004, 07:43
*/
package designformats.specctra;
import datastructures.IndentFileWriter;
import board.BasicBoard;
import board.TestLevel;
/**
* Class for reading and writing dsn-files.
*
* @author alfons
*/
public class DsnFile
{
public enum ReadResult
{
OK, OUTLINE_MISSING, ERROR
}
private DsnFile() {
}
/**
* Creates a routing board from a Specctra dns file.
* The parameters p_item_observers and p_item_id_no_generator are used,
* in case the board is embedded into a host system.
* Returns false, if an error occured.
*/
public static ReadResult read(java.io.InputStream p_input_stream, interactive.IBoardHandling p_board_handling,
board.BoardObservers p_observers, datastructures.IdNoGenerator p_item_id_no_generator, TestLevel p_test_level)
{
Scanner scanner = new SpecctraFileScanner(p_input_stream);
Object curr_token = null;
for (int i = 0; i < 3; ++i)
{
try
{
curr_token = scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read: IO error scanning file");
System.out.println(e);
return ReadResult.ERROR;
}
boolean keyword_ok = true;
if (i == 0)
{
keyword_ok = (curr_token == Keyword.OPEN_BRACKET);
}
else if (i == 1)
{
keyword_ok = (curr_token == Keyword.PCB_SCOPE);
scanner.yybegin(SpecctraFileScanner.NAME); // to overread the name of the pcb for i = 2
}
if (!keyword_ok)
{
System.out.println("DsnFile.read: specctra dsn file format expected");
return ReadResult.ERROR;
}
}
ReadScopeParameter read_scope_par =
new ReadScopeParameter(scanner, p_board_handling, p_observers, p_item_id_no_generator, p_test_level);
boolean read_ok = Keyword.PCB_SCOPE.read_scope(read_scope_par);
ReadResult result;
if (read_ok)
{
result = ReadResult.OK;
if (read_scope_par.autoroute_settings == null)
{
// look for power planes with incorrect layer type and adjust autoroute parameters
adjust_plane_autoroute_settings(p_board_handling);
}
}
else if (!read_scope_par.board_outline_ok)
{
result = ReadResult.OUTLINE_MISSING;
}
else
{
result = ReadResult.ERROR;
}
//tests.Validate.check("after reading dsn", read_scope_par.board_handling.get_routing_board());
return result;
}
/**
* Sets contains_plane to true for nets with a conduction_area covering a
* large part of a signal layer, if that layer does not contain any traces
* This is useful in case the layer type was not set correctly to plane in the dsn-file.
* Returns true, if something was changed.
*/
private static boolean adjust_plane_autoroute_settings(interactive.IBoardHandling p_board_handling)
{
BasicBoard routing_board = p_board_handling.get_routing_board();
board.LayerStructure board_layer_structure = routing_board.layer_structure;
if (board_layer_structure.arr.length <= 2)
{
return false;
}
for (board.Layer curr_layer : board_layer_structure.arr)
{
if (!curr_layer.is_signal)
{
return false;
}
}
boolean[] layer_contains_wires_arr = new boolean[board_layer_structure.arr.length];
boolean[] changed_layer_arr = new boolean[board_layer_structure.arr.length];
for (int i = 0; i < layer_contains_wires_arr.length; ++i)
{
layer_contains_wires_arr[i] = false;
changed_layer_arr[i] = false;
}
java.util.Collection<board.ConductionArea> conduction_area_list = new java.util.LinkedList<board.ConductionArea>();
java.util.Collection<board.Item> item_list = routing_board.get_items();
for (board.Item curr_item : item_list)
{
if (curr_item instanceof board.Trace)
{
int curr_layer = ((board.Trace) curr_item).get_layer();
layer_contains_wires_arr[curr_layer] = true;
}
else if (curr_item instanceof board.ConductionArea)
{
conduction_area_list.add((board.ConductionArea) curr_item);
}
}
boolean nothing_changed = true;
board.BoardOutline board_outline = routing_board.get_outline();
double board_area = 0;
for (int i = 0; i < board_outline.shape_count(); ++i)
{
geometry.planar.TileShape[] curr_piece_arr = board_outline.get_shape(i).split_to_convex();
if (curr_piece_arr != null)
{
for (geometry.planar.TileShape curr_piece : curr_piece_arr)
{
board_area += curr_piece.area();
}
}
}
for (board.ConductionArea curr_conduction_area : conduction_area_list)
{
int layer_no = curr_conduction_area.get_layer();
if (layer_contains_wires_arr[layer_no])
{
continue;
}
board.Layer curr_layer = routing_board.layer_structure.arr[layer_no];
if (!curr_layer.is_signal || layer_no == 0 || layer_no == board_layer_structure.arr.length - 1)
{
continue;
}
geometry.planar.TileShape[] convex_pieces = curr_conduction_area.get_area().split_to_convex();
double curr_area = 0;
for (geometry.planar.TileShape curr_piece : convex_pieces)
{
curr_area += curr_piece.area();
}
if (curr_area < 0.5 * board_area)
{
// skip conduction areas not covering most of the board
continue;
}
for (int i = 0; i < curr_conduction_area.net_count(); ++i)
{
rules.Net curr_net = routing_board.rules.nets.get(curr_conduction_area.get_net_no(i));
curr_net.set_contains_plane(true);
nothing_changed = false;
}
changed_layer_arr[layer_no] = true;
if (curr_conduction_area.get_fixed_state().ordinal() < board.FixedState.USER_FIXED.ordinal())
{
curr_conduction_area.set_fixed_state(board.FixedState.USER_FIXED);
}
}
if (nothing_changed)
{
return false;
}
// Adjust the layer prefered directions in the autoroute settings.
// and deactivate the changed layers.
interactive.AutorouteSettings autoroute_settings = p_board_handling.get_settings().autoroute_settings;
int layer_count = routing_board.get_layer_count();
boolean curr_preferred_direction_is_horizontal =
autoroute_settings.get_preferred_direction_is_horizontal(0);
for (int i = 0; i < layer_count; ++i)
{
if (changed_layer_arr[i])
{
autoroute_settings.set_layer_active(i, false);
}
else if (autoroute_settings.get_layer_active(i))
{
autoroute_settings.set_preferred_direction_is_horizontal(i, curr_preferred_direction_is_horizontal);
curr_preferred_direction_is_horizontal = !curr_preferred_direction_is_horizontal;
}
}
return true;
}
/**
* Writes p_board to a text file in the Specctra dsn format.
* Returns false, if the write failed.
* If p_compat_mode is true, only standard speecctra dsn scopes are written, so that any
* host system with an specctra interface can read them.
*/
public static boolean write(interactive.BoardHandling p_board_handling, java.io.OutputStream p_file, String p_design_name, boolean p_compat_mode)
{
//tests.Validate.check("before writing dsn", p_board);
IndentFileWriter output_file = new IndentFileWriter(p_file);
if (output_file == null)
{
System.out.println("unable to write dsn file");
return false;
}
try
{
write_pcb_scope(p_board_handling, output_file, p_design_name, p_compat_mode);
}
catch (java.io.IOException e)
{
System.out.println("unable to write dsn file");
return false;
}
try
{
output_file.close();
}
catch (java.io.IOException e)
{
System.out.println("unable to close dsn file");
return false;
}
return true;
}
private static void write_pcb_scope(interactive.BoardHandling p_board_handling, IndentFileWriter p_file, String p_design_name, boolean p_compat_mode)
throws java.io.IOException
{
BasicBoard routing_board = p_board_handling.get_routing_board();
WriteScopeParameter write_scope_parameter =
new WriteScopeParameter(routing_board, p_board_handling.settings.autoroute_settings, p_file,
routing_board.communication.specctra_parser_info.string_quote,
routing_board.communication.coordinate_transform, p_compat_mode);
p_file.start_scope();
p_file.write("PCB ");
write_scope_parameter.identifier_type.write(p_design_name, p_file);
Parser.write_scope(write_scope_parameter.file,
write_scope_parameter.board.communication.specctra_parser_info, write_scope_parameter.identifier_type, false);
Resolution.write_scope(p_file, routing_board.communication);
Structure.write_scope(write_scope_parameter);
Placement.write_scope(write_scope_parameter);
Library.write_scope(write_scope_parameter);
PartLibrary.write_scope(write_scope_parameter);
Network.write_scope(write_scope_parameter);
Wiring.write_scope(write_scope_parameter);
p_file.end_scope();
}
static boolean read_on_off_scope(Scanner p_scanner)
{
try
{
Object next_token = p_scanner.next_token();
boolean result = false;
if (next_token == Keyword.ON)
{
result = true;
}
else if (next_token != Keyword.OFF)
{
System.out.println("DsnFile.read_boolean: Keyword.OFF expected");
}
ScopeKeyword.skip_scope(p_scanner);
return result;
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read_boolean: IO error scanning file");
return false;
}
}
static int read_integer_scope(Scanner p_scanner)
{
try
{
int value;
Object next_token = p_scanner.next_token();
if (next_token instanceof Integer)
{
value = ((Integer) next_token).intValue();
}
else
{
System.out.println("DsnFile.read_integer_scope: number expected");
return 0;
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("DsnFile.read_integer_scope: closing bracket expected");
return 0;
}
return value;
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read_integer_scope: IO error scanning file");
return 0;
}
}
static double read_float_scope(Scanner p_scanner)
{
try
{
double value;
Object next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
value = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
value = ((Integer) next_token).intValue();
}
else
{
System.out.println("DsnFile.read_float_scope: number expected");
return 0;
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("DsnFile.read_float_scope: closing bracket expected");
return 0;
}
return value;
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read_float_scope: IO error scanning file");
return 0;
}
}
public static String read_string_scope(Scanner p_scanner)
{
try
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("DsnFile:read_string_scope: String expected");
return null;
}
String result = (String) next_token;
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("DsnFile.read_string_scope: closing bracket expected");
}
return result;
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read_string_scope: IO error scanning file");
return null;
}
}
public static java.util.Collection<String> read_string_list_scope(Scanner p_scanner)
{
java.util.Collection<String> result = new java.util.LinkedList<String>();
try
{
for (;;)
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
if (!(next_token instanceof String))
{
System.out.println("DsnFileread_string_list_scope: string expected");
return null;
}
result.add((String) next_token);
}
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read_string_list_scope: IO error scanning file");
}
return result;
}
static final String CLASS_CLEARANCE_SEPARATOR = "-";
}

View File

@ -1,155 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Keyword.java
*
* Created on 8. Mai 2004, 10:23
*/
package designformats.specctra;
/**
* Enumeration class for keywords of the specctra dsn file format
*
* @author alfons
*/
public class Keyword
{
/**
* The only instances of the internal classes:
*
* ScopeKeywords with an inividual read_scope method are defined in an extra class,
*/
public static final Keyword ABSOLUTE = new Keyword("absolute");
public static final Keyword ACTIVE = new Keyword("active");
public static final Keyword AGAINST_PREFERRED_DIRECTION_TRACE_COSTS = new Keyword("against_preferred_direction_trace_costs");
public static final Keyword ATTACH = new Keyword("attach");
public static final Keyword AUTOROUTE = new Keyword("autoroute");
public static final Keyword AUTOROUTE_SETTINGS = new Keyword("autoroute_settings");
public static final Keyword BACK = new Keyword("back");
public static final Keyword BOUNDARY = new Keyword("boundary");
public static final Keyword CIRCUIT = new Keyword("circuit");
public static final Keyword CIRCLE = new Keyword("circle");
public static final Keyword CLASS = new Keyword("class");
public static final Keyword CLASS_CLASS = new Keyword("class_class");
public static final Keyword CLASSES = new Keyword("classes");
public static final ScopeKeyword COMPONENT_SCOPE = new Component();
public static final Keyword CONSTANT = new Keyword("constant");
public static final Keyword CONTROL = new Keyword("control");
public static final Keyword CLEARANCE = new Keyword("clearance");
public static final Keyword CLEARANCE_CLASS = new Keyword("clearance_class");
public static final Keyword CLOSED_BRACKET = new Keyword(")");
public static final Keyword FANOUT = new Keyword("fanout");
public static final Keyword FLIP_STYLE = new Keyword("flip_style");
public static final Keyword FIX = new Keyword("fix");
public static final Keyword FORTYFIVE_DEGREE = new Keyword("fortyfive_degree");
public static final Keyword FROMTO = new Keyword("fromto");
public static final Keyword FRONT = new Keyword("front");
public static final Keyword GENERATED_BY_FREEROUTE = new Keyword("generated_by_freeroute");
public static final Keyword HORIZONTAL = new Keyword("horizontal");
public static final Keyword HOST_CAD = new Keyword("host_cad");
public static final Keyword HOST_VERSION = new Keyword("host_version");
public static final Keyword IMAGE = new Keyword("image");
public static final Keyword KEEPOUT = new Keyword("keepout");
public static final Keyword LAYER = new Keyword("layer");
public static final Keyword LAYER_RULE = new Keyword("layer_rule");
public static final Keyword LENGTH = new Keyword("length");
public static final ScopeKeyword LIBRARY_SCOPE = new Library();
public static final Keyword LOCK_TYPE = new Keyword("lock_type");
public static final Keyword LOGICAL_PART = new Keyword("logical_part");
public static final Keyword LOGICAL_PART_MAPPING = new Keyword("logical_part_mapping");
public static final Keyword NET = new Keyword("net");
public static final Keyword NETWORK_OUT = new Keyword("network_out");
public static final ScopeKeyword NETWORK_SCOPE = new Network();
public static final Keyword NINETY_DEGREE = new Keyword("ninety_degree");
public static final Keyword NONE = new Keyword("none");
public static final Keyword NORMAL = new Keyword("normal");
public static final Keyword OFF = new Keyword("off");
public static final Keyword ON = new Keyword("on");
public static final Keyword OPEN_BRACKET = new Keyword("(");
public static final Keyword ORDER = new Keyword("order");
public static final Keyword OUTLINE = new Keyword("outline");
public static final Keyword PADSTACK = new Keyword("padstack");
public static final ScopeKeyword PART_LIBRARY_SCOPE = new PartLibrary();
public static final ScopeKeyword PARSER_SCOPE = new Parser();
public static final ScopeKeyword PCB_SCOPE = new ScopeKeyword("pcb");
public static final Keyword PIN = new Keyword("pin");
public static final Keyword PINS = new Keyword("pins");
public static final Keyword PLACE = new Keyword("place");
public static final ScopeKeyword PLACE_CONTROL = new PlaceControl();
public static final Keyword PLACE_KEEPOUT = new Keyword("place_keepout");
public static final ScopeKeyword PLACEMENT_SCOPE = new Placement();
public static final ScopeKeyword PLANE_SCOPE = new Plane();
public static final Keyword PLANE_VIA_COSTS = new Keyword("plane_via_costs");
public static final Keyword PREFERRED_DIRECTION = new Keyword("preferred_direction");
public static final Keyword PREFERRED_DIRECTION_TRACE_COSTS = new Keyword("preferred_direction_trace_costs");
public static final Keyword SNAP_ANGLE = new Keyword("snap_angle");
public static final Keyword POLYGON = new Keyword("polygon");
public static final Keyword POLYGON_PATH = new Keyword("polygon_path");
public static final Keyword POLYLINE_PATH = new Keyword("polyline_path");
public static final Keyword POSITION = new Keyword("position");
public static final Keyword POSTROUTE = new Keyword("postroute");
public static final Keyword POWER = new Keyword("power");
public static final Keyword PULL_TIGHT = new Keyword("pull_tight");
public static final Keyword RECTANGLE = new Keyword("rectangle");
public static final Keyword RESOLUTION_SCOPE = new Resolution();
public static final Keyword ROTATE = new Keyword("rotate");
public static final Keyword ROTATE_FIRST = new Keyword("rotate_first");
public static final Keyword ROUTES = new Keyword("routes");
public static final Keyword RULE = new Keyword("rule");
public static final Keyword RULES = new Keyword("rules");
public static final Keyword SESSION = new Keyword("session");
public static final Keyword SHAPE = new Keyword("shape");
public static final Keyword SHOVE_FIXED = new Keyword("shove_fixed");
public static final Keyword SIDE = new Keyword("side");
public static final Keyword SIGNAL = new Keyword("signal");
public static final Keyword SPARE = new Keyword("spare");
public static final Keyword START_PASS_NO = new Keyword("start_pass_no");
public static final Keyword START_RIPUP_COSTS = new Keyword("start_ripup_costs");
public static final Keyword STRING_QUOTE = new Keyword("string_quote");
public static final ScopeKeyword STRUCTURE_SCOPE = new Structure();
public static final Keyword TYPE = new Keyword("type");
public static final Keyword USE_LAYER = new Keyword("use_layer");
public static final Keyword USE_NET = new Keyword("use_net");
public static final Keyword USE_VIA = new Keyword("use_via");
public static final Keyword VERTICAL = new Keyword("vertical");
public static final Keyword VIA = new Keyword("via");
public static final Keyword VIAS = new Keyword("vias");
public static final Keyword VIA_AT_SMD = new Keyword("via_at_smd");
public static final Keyword VIA_COSTS = new Keyword("via_costs");
public static final Keyword VIA_KEEPOUT = new Keyword("via_keepout");
public static final Keyword VIA_RULE = new Keyword("via_rule");
public static final Keyword WIDTH = new Keyword("width");
public static final Keyword WINDOW = new Keyword("window");
public static final Keyword WIRE = new Keyword("wire");
public static final ScopeKeyword WIRING_SCOPE = new Wiring();
public static final Keyword WRITE_RESOLUTION = new Keyword("write_resolution");
/**
* Returns the name string of this Keyword.
* The name is used for debugging purposes.
*/
public String get_name()
{
return name;
}
private final String name;
/** prevents creating more instances */
protected Keyword(String p_name)
{
name = p_name;
}
}

View File

@ -1,100 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Layer.java
*
* Created on 15. Mai 2004, 08:29
*/
package designformats.specctra;
import java.util.Collection;
import java.util.LinkedList;
/**
* Describes a layer in a Specctra dsn file.
*
* @author alfons
*/
public class Layer
{
/** all layers of the board */
public static final Layer PCB = new Layer("pcb", -1, false);
/** the signal layers */
public static final Layer SIGNAL = new Layer("signal", -1, true);
/**
* Creates a new instance of Layer.
* p_no is the physical layer number starting with 0 at the component side
* and ending at the solder side.
* If p_is_signal, the layer is a signal layer, otherwise it is a powerground layer.
* For Layer objects describing more than 1 layer the number is -1.
* p_net_names is a list of nets for this layer, if the layer is a power plane.
*/
public Layer(String p_name, int p_no, boolean p_is_signal, Collection<String> p_net_names)
{
name = p_name;
no = p_no;
is_signal = p_is_signal;
net_names = p_net_names;
}
/**
* Creates a new instance of Layer.
* p_no is the physical layer number starting with 0 at the component side
* and ending at the solder side.
* If p_is_signal, the layer is a signal layer, otherwise it is a powerground layer.
* For Layer objects describing more than 1 layer the number is -1.
*/
public Layer(String p_name, int p_no, boolean p_is_signal)
{
name = p_name;
no = p_no;
is_signal = p_is_signal;
net_names = new LinkedList<String>();
}
/**
* Writes a layer scope in the stucture scope.
*/
public static void write_scope(WriteScopeParameter p_par, int p_layer_no,
boolean p_write_rule) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("layer ");
board.Layer board_layer = p_par.board.layer_structure.arr[p_layer_no];
p_par.identifier_type.write(board_layer.name, p_par.file);
p_par.file.new_line();
p_par.file.write("(type ");
if (board_layer.is_signal)
{
p_par.file.write("signal)");
}
else
{
p_par.file.write("power)");
}
if (p_write_rule)
{
Rule.write_default_rule(p_par, p_layer_no);
}
p_par.file.end_scope();
}
public final String name;
public final int no;
public final boolean is_signal;
public final java.util.Collection<String> net_names;
}

View File

@ -1,115 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* LayerStructure.java
*
* Created on 16. Mai 2004, 08:08
*/
package designformats.specctra;
import java.util.Collection;
import java.util.Iterator;
/**
* Describes a layer structure read from a dsn file.
*
* @author alfons
*/
public class LayerStructure
{
/** Creates a new instance of LayerStructure from a list of layers*/
public LayerStructure(Collection<Layer> p_layer_list)
{
arr = new Layer[p_layer_list.size()];
Iterator<Layer> it = p_layer_list.iterator();
for (int i = 0; i < arr.length; ++i)
{
arr[i] = it.next();
}
}
/**
* Creates a dsn-LayerStructure from a board LayerStructure.
*/
public LayerStructure(board.LayerStructure p_board_layer_structure)
{
arr = new Layer[p_board_layer_structure.arr.length];
for (int i = 0; i < arr.length; ++i)
{
board.Layer board_layer = p_board_layer_structure.arr[i];
arr[i] = new Layer(board_layer.name, i, board_layer.is_signal);
}
}
/**
* returns the number of the layer with the name p_name,
* -1, if no layer with name p_name exists.
*/
public int get_no(String p_name)
{
for (int i = 0; i < arr.length; ++i)
{
if (p_name.equals(arr[i].name))
{
return i;
}
}
// check for special layers of the Electra autorouter used for the outline
if (p_name.contains("Top"))
{
return 0;
}
if (p_name.contains("Bottom"))
{
return arr.length - 1;
}
return -1;
}
public int signal_layer_count()
{
int result = 0;
for (Layer curr_layer : arr)
{
if (curr_layer.is_signal)
{
++result;
}
}
return result;
}
/**
* Returns, if the net with name p_net_name contains a powwer plane.
*/
public boolean contains_plane(String p_net_name)
{
for (Layer curr_layer : arr)
{
if (!curr_layer.is_signal)
{
if (curr_layer.net_names.contains(p_net_name))
{
return true;
}
}
}
return false;
}
public final Layer[] arr;
}

View File

@ -1,446 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Library.java
*
* Created on 21. Mai 2004, 08:09
*/
package designformats.specctra;
import geometry.planar.IntVector;
import geometry.planar.Vector;
import geometry.planar.PolygonShape;
import geometry.planar.Simplex;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
/**
* Class for reading and writing library scopes from dsn-files.
*
* @author Alfons Wirtz
*/
public class Library extends ScopeKeyword
{
/** Creates a new instance of Library */
public Library()
{
super("library");
}
public boolean read_scope(ReadScopeParameter p_par)
{
board.RoutingBoard board = p_par.board_handling.get_routing_board();
board.library.padstacks = new library.Padstacks(p_par.board_handling.get_routing_board().layer_structure);
Collection<Package> package_list = new LinkedList<Package>();
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Library.read_scope: IO error scanning file");
System.out.println(e);
return false;
}
if (next_token == null)
{
System.out.println("Library.read_scope: unexpected end of file");
return false;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.PADSTACK)
{
if (!read_padstack_scope(p_par.scanner, p_par.layer_structure,
p_par.coordinate_transform, board.library.padstacks))
{
return false;
}
}
else if (next_token == Keyword.IMAGE)
{
Package curr_package = Package.read_scope(p_par.scanner, p_par.layer_structure);
if (curr_package == null)
{
return false;
}
package_list.add(curr_package);
}
else
{
skip_scope(p_par.scanner);
}
}
}
// Set the via padstacks.
if (p_par.via_padstack_names != null)
{
library.Padstack[] via_padstacks = new library.Padstack[p_par.via_padstack_names.size()];
Iterator<String> it = p_par.via_padstack_names.iterator();
int found_padstack_count = 0;
for (int i = 0; i < via_padstacks.length; ++i)
{
String curr_padstack_name = it.next();
library.Padstack curr_padstack = board.library.padstacks.get(curr_padstack_name);
if (curr_padstack != null)
{
via_padstacks[found_padstack_count] = curr_padstack;
++found_padstack_count;
}
else
{
System.out.print("Library.read_scope: via padstack with name ");
System.out.print(curr_padstack_name);
System.out.println(" not found");
}
}
if (found_padstack_count != via_padstacks.length)
{
// Some via padstacks were not found in the padstacks scope of the dsn-file.
library.Padstack[] corrected_padstacks = new library.Padstack[found_padstack_count];
System.arraycopy(via_padstacks, 0, corrected_padstacks, 0, found_padstack_count);
via_padstacks = corrected_padstacks;
}
board.library.set_via_padstacks(via_padstacks);
}
// Create the library packages on the board
board.library.packages = new library.Packages(board.library.padstacks);
Iterator<Package> it = package_list.iterator();
while (it.hasNext())
{
Package curr_package = it.next();
library.Package.Pin[] pin_arr = new library.Package.Pin[curr_package.pin_info_arr.length];
for (int i = 0; i < pin_arr.length; ++i)
{
Package.PinInfo pin_info = curr_package.pin_info_arr[i];
int rel_x = (int) Math.round(p_par.coordinate_transform.dsn_to_board(pin_info.rel_coor[0]));
int rel_y = (int) Math.round(p_par.coordinate_transform.dsn_to_board(pin_info.rel_coor[1]));
Vector rel_coor = new IntVector(rel_x, rel_y);
library.Padstack board_padstack = board.library.padstacks.get(pin_info.padstack_name);
if (board_padstack == null)
{
System.out.println("Library.read_scope: board padstack not found");
return false;
}
pin_arr[i] = new library.Package.Pin(pin_info.pin_name, board_padstack.no, rel_coor, pin_info.rotation);
}
geometry.planar.Shape[] outline_arr = new geometry.planar.Shape[curr_package.outline.size()];
Iterator<Shape> it3 = curr_package.outline.iterator();
for (int i = 0; i < outline_arr.length; ++i)
{
Shape curr_shape = it3.next();
if (curr_shape != null)
{
outline_arr[i] = curr_shape.transform_to_board_rel(p_par.coordinate_transform);
}
else
{
System.out.println("Library.read_scope: outline shape is null");
}
}
generate_missing_keepout_names("keepout_", curr_package.keepouts);
generate_missing_keepout_names("via_keepout_", curr_package.via_keepouts);
generate_missing_keepout_names("place_keepout_", curr_package.place_keepouts);
library.Package.Keepout [] keepout_arr = new library.Package.Keepout [curr_package.keepouts.size()];
Iterator<Shape.ReadAreaScopeResult> it2 = curr_package.keepouts.iterator();
for (int i = 0; i < keepout_arr.length; ++i)
{
Shape.ReadAreaScopeResult curr_keepout = it2.next();
Layer curr_layer = curr_keepout.shape_list.iterator().next().layer;
geometry.planar.Area curr_area = Shape.transform_area_to_board_rel(curr_keepout.shape_list, p_par.coordinate_transform);
keepout_arr[i] = new library.Package.Keepout(curr_keepout.area_name, curr_area, curr_layer.no);
}
library.Package.Keepout [] via_keepout_arr = new library.Package.Keepout [curr_package.via_keepouts.size()];
it2 = curr_package.via_keepouts.iterator();
for (int i = 0; i < via_keepout_arr.length; ++i)
{
Shape.ReadAreaScopeResult curr_keepout = it2.next();
Layer curr_layer = (curr_keepout.shape_list.iterator().next()).layer;
geometry.planar.Area curr_area = Shape.transform_area_to_board_rel(curr_keepout.shape_list, p_par.coordinate_transform);
via_keepout_arr[i] = new library.Package.Keepout(curr_keepout.area_name, curr_area, curr_layer.no);
}
library.Package.Keepout [] place_keepout_arr = new library.Package.Keepout [curr_package.place_keepouts.size()];
it2 = curr_package.place_keepouts.iterator();
for (int i = 0; i < place_keepout_arr.length; ++i)
{
Shape.ReadAreaScopeResult curr_keepout = it2.next();
Layer curr_layer = (curr_keepout.shape_list.iterator().next()).layer;
geometry.planar.Area curr_area = Shape.transform_area_to_board_rel(curr_keepout.shape_list, p_par.coordinate_transform);
place_keepout_arr[i] = new library.Package.Keepout(curr_keepout.area_name, curr_area, curr_layer.no);
}
board.library.packages.add(curr_package.name, pin_arr, outline_arr,
keepout_arr, via_keepout_arr, place_keepout_arr, curr_package.is_front);
}
return true;
}
public static void write_scope(WriteScopeParameter p_par) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("library");
for (int i = 1; i <= p_par.board.library.packages.count(); ++i)
{
Package.write_scope(p_par, p_par.board.library.packages.get(i));
}
for (int i = 1; i <= p_par.board.library.padstacks.count(); ++i)
{
write_padstack_scope(p_par, p_par.board.library.padstacks.get(i));
}
p_par.file.end_scope();
}
public static void write_padstack_scope(WriteScopeParameter p_par, library.Padstack p_padstack) throws java.io.IOException
{
// search the layer range of the padstack
int first_layer_no = 0;
while (first_layer_no < p_par.board.get_layer_count())
{
if (p_padstack.get_shape(first_layer_no) != null)
{
break;
}
++first_layer_no;
}
int last_layer_no = p_par.board.get_layer_count() - 1;
while (last_layer_no >= 0 )
{
if (p_padstack.get_shape(last_layer_no) != null)
{
break;
}
--last_layer_no;
}
if (first_layer_no >= p_par.board.get_layer_count() || last_layer_no < 0)
{
System.out.println("Library.write_padstack_scope: padstack shape not found");
return;
}
p_par.file.start_scope();
p_par.file.write("padstack ");
p_par.identifier_type.write(p_padstack.name, p_par.file);
for (int i = first_layer_no; i <= last_layer_no; ++i)
{
geometry.planar.Shape curr_board_shape = p_padstack.get_shape(i);
if (curr_board_shape == null)
{
continue;
}
board.Layer board_layer = p_par.board.layer_structure.arr[i];
Layer curr_layer = new Layer(board_layer.name, i, board_layer.is_signal);
Shape curr_shape = p_par.coordinate_transform.board_to_dsn_rel(curr_board_shape, curr_layer);
p_par.file.start_scope();
p_par.file.write("shape");
curr_shape.write_scope(p_par.file, p_par.identifier_type);
p_par.file.end_scope();
}
if (!p_padstack.attach_allowed)
{
p_par.file.new_line();
p_par.file.write("(attach off)");
}
if (p_padstack.placed_absolute)
{
p_par.file.new_line();
p_par.file.write("(absolute on)");
}
p_par.file.end_scope();
}
static boolean read_padstack_scope(Scanner p_scanner, LayerStructure p_layer_structure,
CoordinateTransform p_coordinate_transform, library.Padstacks p_board_padstacks)
{
String padstack_name = null;
boolean is_drilllable = true;
boolean placed_absolute = false;
Collection<Shape> shape_list = new LinkedList<Shape>();
try
{
Object next_token = p_scanner.next_token();
if (next_token instanceof String)
{
padstack_name = (String) next_token;
}
else
{
System.out.println("Library.read_padstack_scope: unexpected padstack identifier");
return false;
}
while (next_token != Keyword.CLOSED_BRACKET)
{
Object prev_token = next_token;
next_token = p_scanner.next_token();
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.SHAPE)
{
Shape curr_shape = Shape.read_scope(p_scanner, p_layer_structure);
if (curr_shape != null)
{
shape_list.add(curr_shape);
}
// overread the closing bracket and unknown scopes.
Object curr_next_token = p_scanner.next_token();
while (curr_next_token == Keyword.OPEN_BRACKET)
{
ScopeKeyword.skip_scope(p_scanner);
curr_next_token = p_scanner.next_token();
}
if (curr_next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Library.read_padstack_scope: closing bracket expected");
return false;
}
}
else if (next_token == Keyword.ATTACH)
{
is_drilllable = DsnFile.read_on_off_scope(p_scanner);
}
else if (next_token == Keyword.ABSOLUTE)
{
placed_absolute = DsnFile.read_on_off_scope(p_scanner);
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
}
}
catch (java.io.IOException e)
{
System.out.println("Library.read_padstack_scope: IO error scanning file");
System.out.println(e);
return false;
}
if (p_board_padstacks.get(padstack_name) != null)
{
// Padstack exists already
return true;
}
if (shape_list.isEmpty())
{
System.out.print("Library.read_padstack_scope: shape not found for padstack with name ");
System.out.println(padstack_name);
return true;
}
geometry.planar.ConvexShape[] padstack_shapes = new geometry.planar.ConvexShape[p_layer_structure.arr.length];
Iterator<Shape> it = shape_list.iterator();
while (it.hasNext())
{
Shape pad_shape = it.next();
geometry.planar.Shape curr_shape = pad_shape.transform_to_board_rel(p_coordinate_transform);
geometry.planar.ConvexShape convex_shape;
if (curr_shape instanceof geometry.planar.ConvexShape)
{
convex_shape = (geometry.planar.ConvexShape) curr_shape;
}
else
{
if (curr_shape instanceof PolygonShape)
{
curr_shape = ((PolygonShape)curr_shape).convex_hull();
}
geometry.planar.TileShape[] convex_shapes = curr_shape.split_to_convex();
if (convex_shapes.length != 1)
{
System.out.println("Library.read_padstack_scope: convex shape expected");
}
convex_shape = convex_shapes[0];
if (convex_shape instanceof Simplex)
{
convex_shape = ((Simplex) convex_shape).simplify();
}
}
geometry.planar.ConvexShape padstack_shape = convex_shape;
if (padstack_shape != null)
{
if (padstack_shape.dimension() < 2)
{
System.out.print("Library.read_padstack_scope: shape is not an area ");
// enllarge the shape a little bit, so that it is an area
padstack_shape = padstack_shape.offset(1);
if (padstack_shape.dimension() < 2)
{
padstack_shape = null;
}
}
}
if (pad_shape.layer == Layer.PCB || pad_shape.layer == Layer.SIGNAL)
{
for (int i = 0; i < padstack_shapes.length; ++i)
{
padstack_shapes[i] = padstack_shape;
}
}
else
{
int shape_layer = p_layer_structure.get_no(pad_shape.layer.name);
if (shape_layer < 0 || shape_layer >= padstack_shapes.length)
{
System.out.println("Library.read_padstack_scope: layer number found");
return false;
}
padstack_shapes[shape_layer] = padstack_shape;
}
}
p_board_padstacks.add(padstack_name, padstack_shapes, is_drilllable, placed_absolute);
return true;
}
private void generate_missing_keepout_names(String p_keepout_type, Collection<Shape.ReadAreaScopeResult> p_keepout_list)
{
boolean all_names_existing = true;
for (Shape.ReadAreaScopeResult curr_keepout : p_keepout_list)
{
if (curr_keepout.area_name == null)
{
all_names_existing = false;
break;
}
}
if (all_names_existing)
{
return;
}
// generate names
Integer curr_name_index = 1;
for (Shape.ReadAreaScopeResult curr_keepout : p_keepout_list)
{
curr_keepout.area_name = p_keepout_type + curr_name_index.toString();
++curr_name_index;
}
}
}

View File

@ -1,162 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Net.java
*
* Created on 19. Mai 2004, 08:58
*/
package designformats.specctra;
import java.util.Collection;
import java.util.Set;
import java.util.TreeSet;
import java.util.Iterator;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Class for reading and writing net scopes from dsn-files.
*
* @author alfons
*/
public class Net
{
/** Creates a new instance of Net */
public Net(Id p_net_id)
{
id = p_net_id;
}
public static void write_scope(WriteScopeParameter p_par, rules.Net p_net, Collection<board.Pin> p_pin_list) throws java.io.IOException
{
p_par.file.start_scope();
write_net_id(p_net, p_par.file, p_par.identifier_type);
// write the pins scope
p_par.file.start_scope();
p_par.file.write("pins");
Iterator<board.Pin> it = p_pin_list.iterator();
while (it.hasNext())
{
board.Pin curr_pin = it.next();
if (curr_pin.contains_net(p_net.net_number))
{
write_pin(p_par, curr_pin);
}
}
p_par.file.end_scope();
p_par.file.end_scope();
}
public static void write_net_id( rules.Net p_net, IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.write("net ");
p_identifier_type.write(p_net.name, p_file);
p_file.write(" ");
Integer subnet_number = p_net.subnet_number;
p_file.write(subnet_number.toString());
}
public static void write_pin(WriteScopeParameter p_par, board.Pin p_pin) throws java.io.IOException
{
board.Component curr_component = p_par.board.components.get(p_pin.get_component_no());
if (curr_component == null)
{
System.out.println("Net.write_scope: component not found");
return;
}
library.Package.Pin lib_pin = curr_component.get_package().get_pin(p_pin.get_index_in_package());
if (lib_pin == null)
{
System.out.println("Net.write_scope: pin number out of range");
return;
}
p_par.file.new_line();
p_par.identifier_type.write(curr_component.name, p_par.file);
p_par.file.write("-");
p_par.identifier_type.write(lib_pin.name, p_par.file);
}
public void set_pins(Collection<Pin> p_pin_list)
{
pin_list = new TreeSet<Pin>();
for (Pin curr_pin : p_pin_list)
{
pin_list.add(curr_pin);
}
}
public Set<Pin> get_pins()
{
return pin_list;
}
public final Id id;
/** List of elements of type Pin. */
private Set<Pin> pin_list = null;
public static class Id implements Comparable<Id>
{
public Id(String p_name, int p_subnet_number)
{
name = p_name;
subnet_number = p_subnet_number;
}
public int compareTo(Id p_other)
{
int result = this.name.compareTo(p_other.name);
if (result == 0)
{
result = this.subnet_number - p_other.subnet_number;
}
return result;
}
public final String name;
public final int subnet_number;
}
/**
* Sorted tuple of component name and pin name.
*/
public static class Pin implements Comparable<Pin>
{
public Pin(String p_component_name, String p_pin_name)
{
component_name = p_component_name;
pin_name = p_pin_name;
}
public int compareTo(Pin p_other)
{
int result = this.component_name.compareTo(p_other.component_name);
if (result == 0)
{
result = this.pin_name.compareTo(p_other.pin_name);
}
return result;
}
public final String component_name;
public final String pin_name;
}
}

View File

@ -1,249 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* NetClass.java
*
* Created on 13. April 2005, 06:55
*/
package designformats.specctra;
import java.util.Collection;
import java.util.LinkedList;
/**
* Contains the information of a Specctra Class scope.
*
* @author alfons
*/
public class NetClass
{
public static NetClass read_scope(Scanner p_scanner)
{
try
{
// read the class name
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("NetClass.read_scope: String expected");
return null;
}
String class_name = (String) next_token;
Collection<String> net_list = new LinkedList<String>();
boolean rules_missing = false;
// read the nets belonging to the class
for (;;)
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
next_token = p_scanner.next_token();
if (next_token == Keyword.OPEN_BRACKET)
{
break;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
rules_missing = true;
break;
}
if (!(next_token instanceof String))
{
System.out.println("NetClass.read_scope: String expected");
return null;
}
net_list.add((String) next_token);
}
Collection<Rule> rules = new LinkedList<Rule>();
Collection<Rule.LayerRule> layer_rules = new LinkedList<Rule.LayerRule>();
Collection<String> use_via = new LinkedList<String>();
Collection<String> use_layer = new LinkedList<String>();
String via_rule = null;
String trace_clearance_class = null;
boolean pull_tight = true;
boolean shove_fixed = false;
double min_trace_length = 0;
double max_trace_length = 0;
if (!rules_missing)
{
Object prev_token = next_token;
for (;;)
{
next_token = p_scanner.next_token();
if (next_token == null)
{
System.out.println("NetClass.read_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.RULE)
{
rules.addAll(Rule.read_scope(p_scanner));
}
else if (next_token == Keyword.LAYER_RULE)
{
layer_rules.add(Rule.read_layer_rule_scope(p_scanner));
}
else if (next_token == Keyword.VIA_RULE)
{
via_rule = DsnFile.read_string_scope(p_scanner);
}
else if (next_token == Keyword.CIRCUIT)
{
Circuit.ReadScopeResult curr_rule = Circuit.read_scope(p_scanner);
if (curr_rule != null)
{
max_trace_length = curr_rule.max_length;
min_trace_length = curr_rule.min_length;
use_via.addAll(curr_rule.use_via);
use_layer.addAll(curr_rule.use_layer);
}
}
else if (next_token == Keyword.CLEARANCE_CLASS)
{
trace_clearance_class = DsnFile.read_string_scope(p_scanner);
if (trace_clearance_class == null)
{
return null;
}
}
else if (next_token == Keyword.SHOVE_FIXED)
{
shove_fixed = DsnFile.read_on_off_scope(p_scanner);
}
else if (next_token == Keyword.PULL_TIGHT)
{
pull_tight = DsnFile.read_on_off_scope(p_scanner);
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
prev_token = next_token;
}
}
return new NetClass(class_name, trace_clearance_class, net_list, rules, layer_rules,
use_via, use_layer, via_rule, shove_fixed, pull_tight, min_trace_length, max_trace_length);
}
catch (java.io.IOException e)
{
System.out.println("NetClass.read_scope: IO error while scanning file");
return null;
}
}
public static ClassClass read_class_class_scope(Scanner p_scanner)
{
try
{
Collection<String> classes = new LinkedList<String>();
Collection<Rule> rules = new LinkedList<Rule>();
Collection<Rule.LayerRule> layer_rules = new LinkedList<Rule.LayerRule>();
Object prev_token = null;
for (;;)
{
Object next_token = p_scanner.next_token();
if (next_token == null)
{
System.out.println("ClassClass.read_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.CLASSES)
{
classes.addAll(DsnFile.read_string_list_scope(p_scanner));
}
else if (next_token == Keyword.RULE)
{
rules.addAll(Rule.read_scope(p_scanner));
}
else if (next_token == Keyword.LAYER_RULE)
{
layer_rules.add(Rule.read_layer_rule_scope(p_scanner));
}
}
prev_token = next_token;
}
return new ClassClass(classes, rules, layer_rules);
}
catch (java.io.IOException e)
{
System.out.println("NetClass.read_scope: IO error while scanning file");
return null;
}
}
/** Creates a new instance of NetClass */
public NetClass(String p_name, String p_trace_clearance_class, Collection<String> p_net_list,
Collection<Rule> p_rules, Collection<Rule.LayerRule> p_layer_rules, Collection<String> p_use_via,
Collection<String> p_use_layer, String p_via_rule, boolean p_shove_fixed, boolean p_pull_tight,
double p_min_trace_length, double p_max_trace_length)
{
name = p_name;
trace_clearance_class = p_trace_clearance_class;
net_list = p_net_list;
rules = p_rules;
layer_rules = p_layer_rules;
use_via = p_use_via;
use_layer = p_use_layer;
via_rule = p_via_rule;
shove_fixed = p_shove_fixed;
pull_tight = p_pull_tight;
min_trace_length = p_min_trace_length;
max_trace_length = p_max_trace_length;
}
public final String name;
public final String trace_clearance_class;
public final Collection<String> net_list;
public final Collection<Rule> rules;
public final Collection<Rule.LayerRule> layer_rules;
public final Collection<String> use_via;
public final Collection<String> use_layer;
public final String via_rule;
public final boolean shove_fixed;
public final boolean pull_tight;
public final double min_trace_length;
public final double max_trace_length;
public static class ClassClass
{
public ClassClass( Collection<String> p_class_names, Collection<Rule> p_rules,
Collection<Rule.LayerRule> p_layer_rules)
{
class_names = p_class_names;
rules = p_rules;
layer_rules = p_layer_rules;
}
public final Collection<String> class_names;
public final Collection<Rule> rules;
public final Collection<Rule.LayerRule> layer_rules;
}
}

View File

@ -1,100 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* NetList.java
*
* Created on 19. Mai 2004, 09:05
*/
package designformats.specctra;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import java.util.Set;
/**
* Describes a list of nets sorted by its names.
* The net number is generated internally.
*
* @author alfons
*/
public class NetList
{
/**
* Returns true, if the netlist contains a net with the input name.
*/
public boolean contains(Net.Id p_net_id)
{
return nets.containsKey(p_net_id);
}
/**
* Adds a new net mit the input name to the net list.
* Returns null, if a net with p_name already exists in the net list.
* In this case no new net is added.
*/
public Net add_net(Net.Id p_net_id)
{
Net result;
if (nets.containsKey(p_net_id))
{
result = null;
}
else
{
result = new Net(p_net_id);
nets.put(p_net_id, result);
}
return result;
}
/**
* Returns the net with the input name, or null,
* if the netlist does not contain a net with the input name.
*/
public Net get_net(Net.Id p_net_id)
{
Object value = nets.get(p_net_id);
return ((Net) value);
}
/**
* Returns all nets in this net list containing the input pin.
*/
public Collection<Net> get_nets(String p_component_name, String p_pin_name)
{
Collection<Net> result = new java.util.LinkedList<Net>();
Net.Pin search_pin = new Net.Pin(p_component_name, p_pin_name);
Collection<Net> net_list = nets.values();
Iterator<Net> it = net_list.iterator();
while (it.hasNext())
{
Net curr_net = it.next();
Set<Net.Pin> net_pins = curr_net.get_pins();
if (net_pins != null && net_pins.contains(search_pin))
{
result.add(curr_net);
}
}
return result;
}
/** The entries of this map are of type Net, the keys are the net_ids. */
private final Map<Net.Id, Net> nets = new TreeMap<Net.Id, Net>();
}

View File

@ -1,504 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Package.java
*
* Created on 21. Mai 2004, 09:31
*/
package designformats.specctra;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import board.Item;
/**
* Class for reading and writing package scopes from dsn-files.
*
* @author alfons
*/
public class Package
{
/** Creates a new instance of Package */
public Package(String p_name, PinInfo[] p_pin_info_arr, Collection<Shape> p_outline, Collection<Shape.ReadAreaScopeResult> p_keepouts,
Collection<Shape.ReadAreaScopeResult> p_via_keepouts, Collection<Shape.ReadAreaScopeResult> p_place_keepouts, boolean p_is_front)
{
name = p_name;
pin_info_arr = p_pin_info_arr;
outline = p_outline;
keepouts = p_keepouts;
via_keepouts = p_via_keepouts;
place_keepouts = p_place_keepouts;
is_front = p_is_front;
}
public static Package read_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
try
{
boolean is_front = true;
Collection <Shape> outline = new LinkedList<Shape>();
Collection<Shape.ReadAreaScopeResult> keepouts = new LinkedList<Shape.ReadAreaScopeResult>();
Collection<Shape.ReadAreaScopeResult> via_keepouts = new LinkedList<Shape.ReadAreaScopeResult>();
Collection<Shape.ReadAreaScopeResult> place_keepouts = new LinkedList<Shape.ReadAreaScopeResult>();
Object next_token = p_scanner.next_token();
if ( !(next_token instanceof String))
{
System.out.println("Package.read_scope: String expected");
return null;
}
String package_name = (String) next_token;
Collection<PinInfo> pin_info_list = new LinkedList<PinInfo>();
for (;;)
{
Object prev_token = next_token;
next_token = p_scanner.next_token();
if (next_token == null)
{
System.out.println("Package.read_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.PIN)
{
PinInfo next_pin = read_pin_info(p_scanner);
if (next_pin == null)
{
return null;
}
pin_info_list.add(next_pin);
}
else if (next_token == Keyword.SIDE)
{
is_front = read_placement_side(p_scanner);
}
else if (next_token == Keyword.OUTLINE)
{
Shape curr_shape = Shape.read_scope(p_scanner, p_layer_structure);
if (curr_shape != null)
{
outline.add(curr_shape);
}
// overread closing bracket
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Package.read_scope: closed bracket expected");
return null;
}
}
else if (next_token == Keyword.KEEPOUT)
{
Shape.ReadAreaScopeResult keepout_area = Shape.read_area_scope(p_scanner, p_layer_structure, false);
if (keepout_area != null)
{
keepouts.add(keepout_area);
}
}
else if (next_token == Keyword.VIA_KEEPOUT)
{
Shape.ReadAreaScopeResult keepout_area = Shape.read_area_scope(p_scanner, p_layer_structure, false);
if (keepout_area != null)
{
via_keepouts.add(keepout_area);
}
}
else if (next_token == Keyword.PLACE_KEEPOUT)
{
Shape.ReadAreaScopeResult keepout_area = Shape.read_area_scope(p_scanner, p_layer_structure, false);
if (keepout_area != null)
{
place_keepouts.add(keepout_area);
}
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
}
PinInfo [] pin_info_arr = new PinInfo[pin_info_list.size()];
Iterator<PinInfo> it = pin_info_list.iterator();
for (int i = 0; i < pin_info_arr.length; ++i)
{
pin_info_arr[i] = it.next();
}
return new Package(package_name, pin_info_arr, outline, keepouts, via_keepouts, place_keepouts, is_front);
}
catch (java.io.IOException e)
{
System.out.println("Package.read_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
public static void write_scope(WriteScopeParameter p_par, library.Package p_package) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("image ");
p_par.identifier_type.write(p_package.name, p_par.file);
// write the placement side of the package
p_par.file.new_line();
p_par.file.write("(side ");
if (p_package.is_front)
{
p_par.file.write("front)");
}
else
{
p_par.file.write("back)");
}
// write the pins of the package
for (int i = 0; i < p_package.pin_count(); ++i)
{
library.Package.Pin curr_pin = p_package.get_pin(i);
p_par.file.new_line();
p_par.file.write("(pin ");
library.Padstack curr_padstack = p_par.board.library.padstacks.get(curr_pin.padstack_no);
p_par.identifier_type.write(curr_padstack.name, p_par.file);
p_par.file.write(" ");
p_par.identifier_type.write(curr_pin.name, p_par.file);
double [] rel_coor = p_par.coordinate_transform.board_to_dsn(curr_pin.relative_location);
for(int j = 0; j < rel_coor.length; ++j)
{
p_par.file.write(" ");
p_par.file.write((new Double(rel_coor[j])).toString());
}
int rotation = (int) Math.round(curr_pin.rotation_in_degree);
if (rotation != 0)
{
p_par.file.write("(rotate ");
p_par.file.write((new Integer(rotation)).toString());
p_par.file.write(")");
}
p_par.file.write(")");
}
// write the keepouts belonging to the package.
for (int i = 0; i < p_package.keepout_arr.length; ++i)
{
write_package_keepout(p_package.keepout_arr[i], p_par, false);
}
for (int i = 0; i < p_package.via_keepout_arr.length; ++i)
{
write_package_keepout(p_package.via_keepout_arr[i], p_par, true);
}
// write the package outline.
for (int i = 0; i < p_package.outline.length; ++i)
{
p_par.file.start_scope();
p_par.file.write("outline");
Shape curr_outline = p_par.coordinate_transform.board_to_dsn_rel(p_package.outline[i], Layer.SIGNAL);
curr_outline.write_scope(p_par.file, p_par.identifier_type);
p_par.file.end_scope();
}
p_par.file.end_scope();
}
private static void write_package_keepout(library.Package.Keepout p_keepout, WriteScopeParameter p_par,
boolean p_is_via_keepout) throws java.io.IOException
{
Layer keepout_layer;
if (p_keepout.layer >= 0)
{
board.Layer board_layer = p_par.board.layer_structure.arr[p_keepout.layer];
keepout_layer = new Layer(board_layer.name, p_keepout.layer, board_layer.is_signal);
}
else
{
keepout_layer = Layer.SIGNAL;
}
geometry.planar.Shape boundary_shape;
geometry.planar.Shape [] holes;
if (p_keepout.area instanceof geometry.planar.Shape)
{
boundary_shape = (geometry.planar.Shape) p_keepout.area ;
holes = new geometry.planar.Shape [0];
}
else
{
boundary_shape = p_keepout.area .get_border();
holes = p_keepout.area .get_holes();
}
p_par.file.start_scope();
if (p_is_via_keepout)
{
p_par.file.write("via_keepout");
}
else
{
p_par.file.write("keepout");
}
Shape dsn_shape = p_par.coordinate_transform.board_to_dsn(boundary_shape, keepout_layer);
if (dsn_shape != null)
{
dsn_shape.write_scope(p_par.file, p_par.identifier_type);
}
for (int j = 0; j < holes.length; ++j)
{
Shape dsn_hole = p_par.coordinate_transform.board_to_dsn(holes[j], keepout_layer);
dsn_hole.write_hole_scope(p_par.file, p_par.identifier_type);
}
p_par.file.end_scope();
}
/** Reads the information of a single pin in a package. */
private static PinInfo read_pin_info(Scanner p_scanner)
{
try
{
// Read the padstack name.
p_scanner.yybegin(SpecctraFileScanner.NAME);
String padstack_name = null;
Object next_token = p_scanner.next_token();
if ( next_token instanceof String)
{
padstack_name = (String) next_token;
}
else if ( next_token instanceof Integer)
{
padstack_name = ((Integer) next_token).toString();
}
else
{
System.out.println("Package.read_pin_info: String or Integer expected");
return null;
}
double rotation = 0;
p_scanner.yybegin(SpecctraFileScanner.NAME); // to be able to handle pin names starting with a digit.
next_token = p_scanner.next_token();
if (next_token == Keyword.OPEN_BRACKET)
{
// read the padstack rotation
next_token = p_scanner.next_token();
if (next_token == Keyword.ROTATE)
{
rotation = read_rotation(p_scanner);
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
p_scanner.yybegin(SpecctraFileScanner.NAME);
next_token = p_scanner.next_token();
}
// Read the pin name.
String pin_name = null;
if ( next_token instanceof String)
{
pin_name = (String) next_token;
}
else if ( next_token instanceof Integer)
{
pin_name = ((Integer) next_token).toString();
}
else
{
System.out.println("Package.read_pin_info: String or Integer expected");
return null;
}
double [] pin_coor = new double [2];
for (int i = 0; i < 2; ++i)
{
next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
pin_coor[i] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
pin_coor[i] = ((Integer) next_token).intValue();
}
else
{
System.out.println("Package.read_pin_info: number expected");
return null;
}
}
// Handle scopes at the end of the pin scope.
for (;;)
{
Object prev_token = next_token;
next_token = p_scanner.next_token();
if (next_token == null)
{
System.out.println("Package.read_pin_info: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.ROTATE)
{
rotation = read_rotation(p_scanner);
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
}
}
return new PinInfo(padstack_name, pin_name, pin_coor, rotation);
}
catch (java.io.IOException e)
{
System.out.println("Package.read_pin_info: IO error while scanning file");
return null;
}
}
private static double read_rotation(Scanner p_scanner)
{
double result = 0;
try
{
Object next_token = p_scanner.next_token();
if (next_token instanceof Integer)
{
result = ((Integer)next_token).intValue();
}
else if (next_token instanceof Double)
{
result = ((Double)next_token).doubleValue();
}
else
{
System.out.println("Package.read_rotation: number expected");
}
// Overread The closing bracket.
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Package.read_rotation: closing bracket expected");
}
}
catch (java.io.IOException e)
{
System.out.println("Package.read_rotation: IO error while scanning file");
}
return result;
}
/**
* Writes the placements of p_package to a Specctra dsn-file.
*/
public static void write_placement_scope(WriteScopeParameter p_par, library.Package p_package)
throws java.io.IOException
{
Collection<Item> board_items = p_par.board.get_items();
boolean component_found = false;
for (int i = 1; i <= p_par.board.components.count(); ++i)
{
board.Component curr_component = p_par.board.components.get(i);
if (curr_component.get_package() == p_package)
{
// check, if not all items of the component are deleted
boolean undeleted_item_found = false;
Iterator<Item> it = board_items.iterator();
while (it.hasNext())
{
Item curr_item = it.next();
if (curr_item.get_component_no() == curr_component.no)
{
undeleted_item_found = true;
break;
}
}
if (undeleted_item_found || !curr_component.is_placed())
{
if (!component_found)
{
// write the scope header
p_par.file.start_scope();
p_par.file.write("component ");
p_par.identifier_type.write(p_package.name, p_par.file);
component_found = true;
}
Component.write_scope(p_par, curr_component);
}
}
}
if (component_found)
{
p_par.file.end_scope();
}
}
private static boolean read_placement_side(Scanner p_scanner) throws java.io.IOException
{
Object next_token = p_scanner.next_token();
boolean result = (next_token != Keyword.BACK);
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Package.read_placement_side: closing bracket expected");
}
return result;
}
public final String name;
/** List of objects of type PinInfo. */
public final PinInfo[] pin_info_arr;
/** The outline of the package. */
public final Collection<Shape> outline;
/** Collection of keepoouts belonging to this package */
public final Collection<Shape.ReadAreaScopeResult> keepouts;
/** Collection of via keepoouts belonging to this package */
public final Collection<Shape.ReadAreaScopeResult> via_keepouts;
/** Collection of place keepoouts belonging to this package */
public final Collection<Shape.ReadAreaScopeResult> place_keepouts;
/** If false, the package is placed on the back side of the board */
public final boolean is_front;
/** Describes the Iinformation of a pin in a package. */
static public class PinInfo
{
PinInfo(String p_padstack_name, String p_pin_name, double [] p_rel_coor, double p_rotation)
{
padstack_name = p_padstack_name;
pin_name = p_pin_name;
rel_coor = p_rel_coor;
rotation = p_rotation;
}
/** Phe name of the pastack of this pin. */
public final String padstack_name;
/** Phe name of this pin. */
public final String pin_name;
/** The x- and y-coordinates relative to the package location. */
public final double [] rel_coor;
/** The rotation of the pin relative to the package. */
public final double rotation;
}
}

View File

@ -1,271 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Parser.java
*
* Created on 24. Januar 2005, 08:29
*/
package designformats.specctra;
import board.Communication.SpecctraParserInfo;
/**
* Class for reading and writing parser scopes from dsn-files.
*
* @author Alfons Wirtz
*/
public class Parser extends ScopeKeyword
{
/** Creates a new instance of Parser */
public Parser()
{
super("parser");
}
public boolean read_scope(ReadScopeParameter p_par)
{
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Parser.read_scope: IO error scanning file");
return false;
}
if (next_token == null)
{
System.out.println("Parser.read_scope: unexpected end of file");
return false;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
boolean read_ok = true;
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.STRING_QUOTE)
{
String quote_char = read_quote_char(p_par.scanner);
if (quote_char == null)
{
return false;
}
p_par.string_quote = quote_char;
}
else if (next_token == Keyword.HOST_CAD)
{
p_par.host_cad = DsnFile.read_string_scope(p_par.scanner);
}
else if (next_token == Keyword.HOST_VERSION)
{
p_par.host_version = DsnFile.read_string_scope(p_par.scanner);
}
else if (next_token == Keyword.CONSTANT)
{
String[] curr_constant = read_constant(p_par);
if (curr_constant != null)
{
p_par.constants.add(curr_constant);
}
}
else if (next_token == Keyword.WRITE_RESOLUTION)
{
p_par.write_resolution = read_write_solution(p_par);
}
else if (next_token == Keyword.GENERATED_BY_FREEROUTE)
{
p_par.dsn_file_generated_by_host = false;
// skip the closing bracket
skip_scope(p_par.scanner);
}
else
{
skip_scope(p_par.scanner);
}
}
if (!read_ok)
{
return false;
}
}
return true;
}
private static SpecctraParserInfo.WriteResolution read_write_solution(ReadScopeParameter p_par)
{
try
{
Object next_token = p_par.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Parser.read_write_solution: string expected");
return null;
}
String resolution_string = (String) next_token;
next_token = p_par.scanner.next_token();
if (!(next_token instanceof Integer))
{
System.out.println("Parser.read_write_solution: integer expected expected");
return null;
}
int resolution_value = (Integer) next_token;
next_token = p_par.scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Parser.read_write_solution: closing_bracket expected");
return null;
}
return new SpecctraParserInfo.WriteResolution(resolution_string, resolution_value);
}
catch (java.io.IOException e)
{
System.out.println("Parser.read_write_solution: IO error scanning file");
return null;
}
}
private static String[] read_constant(ReadScopeParameter p_par)
{
try
{
String[] result = new String[2];
p_par.scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_par.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Parser.read_constant: string expected");
return null;
}
result[0] = (String) next_token;
p_par.scanner.yybegin(SpecctraFileScanner.NAME);
next_token = p_par.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Parser.read_constant: string expected");
return null;
}
result[1] = (String) next_token;
next_token = p_par.scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Parser.read_constant: closing_bracket expected");
return null;
}
return result;
}
catch (java.io.IOException e)
{
System.out.println("Parser.read_constant: IO error scanning file");
return null;
}
}
/**
* p_reduced is true if the scope is written to a session file.
*/
public static void write_scope(datastructures.IndentFileWriter p_file, SpecctraParserInfo p_parser_info,
datastructures.IdentifierType p_identifier_type, boolean p_reduced) throws java.io.IOException
{
p_file.start_scope();
p_file.write("parser");
if (!p_reduced)
{
p_file.new_line();
p_file.write("(string_quote ");
p_file.write(p_parser_info.string_quote);
p_file.write(")");
p_file.new_line();
p_file.write("(space_in_quoted_tokens on)");
}
if (p_parser_info.host_cad != null)
{
p_file.new_line();
p_file.write("(host_cad ");
p_identifier_type.write(p_parser_info.host_cad, p_file);
p_file.write(")");
}
if (p_parser_info.host_version != null)
{
p_file.new_line();
p_file.write("(host_version ");
p_identifier_type.write(p_parser_info.host_version, p_file);
p_file.write(")");
}
if (p_parser_info.constants != null)
{
for (String[] curr_constant : p_parser_info.constants)
{
p_file.new_line();
p_file.write("(constant ");
for (int i = 0; i < curr_constant.length; ++i)
{
p_identifier_type.write(curr_constant[i], p_file);
p_file.write(" ");
}
p_file.write(")");
}
}
if (p_parser_info.write_resolution != null)
{
p_file.new_line();
p_file.write("(write_resolution ");
p_file.write(p_parser_info.write_resolution.char_name.substring(0, 1));
p_file.write(" ");
Integer positive_int = p_parser_info.write_resolution.positive_int;
p_file.write(positive_int.toString());
p_file.write(")");
}
if (!p_reduced)
{
p_file.new_line();
p_file.write("(generated_by_freeroute)");
}
p_file.end_scope();
}
private static String read_quote_char(Scanner p_scanner)
{
try
{
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Parser.read_quote_char: string expected");
return null;
}
String result = (String) next_token;
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Parser.read_quote_char: closing bracket expected");
return null;
}
return result;
}
catch (java.io.IOException e)
{
System.out.println("Parser.read_quote_char: IO error scanning file");
return null;
}
}
}

View File

@ -1,393 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* PartLibrary.java
*
* Created on 23. Maerz 2005, 08:36
*/
package designformats.specctra;
/**
*
* @author Alfons Wirtz
*/
public class PartLibrary extends ScopeKeyword
{
/** Creates a new instance of PartLibrary */
public PartLibrary()
{
super("part_library");
}
public boolean read_scope(ReadScopeParameter p_par)
{
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("PartLibrary.read_scope: IO error scanning file");
System.out.println(e);
return false;
}
if (next_token == null)
{
System.out.println("PartLibrary.read_scope: unexpected end of file");
return false;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.LOGICAL_PART_MAPPING)
{
LogicalPartMapping next_mapping = read_logical_part_mapping(p_par.scanner);
if (next_mapping == null)
{
return false;
}
p_par.logical_part_mappings.add(next_mapping);
}
else if (next_token == Keyword.LOGICAL_PART)
{
LogicalPart next_part = read_logical_part(p_par.scanner);
if (next_part == null)
{
return false;
}
p_par.logical_parts.add(next_part);
}
else
{
skip_scope(p_par.scanner);
}
}
}
return true;
}
public static void write_scope(WriteScopeParameter p_par) throws java.io.IOException
{
library.LogicalParts logical_parts = p_par.board.library.logical_parts;
if (logical_parts.count() <= 0)
{
return;
}
p_par.file.start_scope();
p_par.file.write("part_library");
// write the logical part mappings
for (int i = 1; i <= logical_parts.count(); ++i)
{
library.LogicalPart curr_part = logical_parts.get(i);
p_par.file.start_scope();
p_par.file.write("logical_part_mapping ");
p_par.identifier_type.write(curr_part.name, p_par.file);
p_par.file.new_line();
p_par.file.write("(comp");
for (int j = 1; j <= p_par.board.components.count(); ++j)
{
board.Component curr_compomnent = p_par.board.components.get(j);
if (curr_compomnent.get_logical_part() == curr_part)
{
p_par.file.write(" ");
p_par.file.write(curr_compomnent.name);
}
}
p_par.file.write(")");
p_par.file.end_scope();
}
// write the logical parts.
for (int i = 1; i <= logical_parts.count(); ++i)
{
library.LogicalPart curr_part = logical_parts.get(i);
p_par.file.start_scope();
p_par.file.write("logical_part ");
p_par.identifier_type.write(curr_part.name, p_par.file);
p_par.file.new_line();
for (int j = 0; j < curr_part.pin_count(); ++j)
{
p_par.file.new_line();
library.LogicalPart.PartPin curr_pin = curr_part.get_pin(j);
p_par.file.write("(pin ");
p_par.identifier_type.write(curr_pin.pin_name, p_par.file);
p_par.file.write(" 0 ");
p_par.identifier_type.write(curr_pin.gate_name, p_par.file);
p_par.file.write(" ");
Integer gate_swap_code = curr_pin.gate_swap_code;
p_par.file.write(gate_swap_code.toString());
p_par.file.write(" ");
p_par.identifier_type.write(curr_pin.gate_pin_name, p_par.file);
p_par.file.write(" ");
Integer gate_pin_swap_code = curr_pin.gate_pin_swap_code;
p_par.file.write(gate_pin_swap_code.toString());
p_par.file.write(")");
}
p_par.file.end_scope();
}
p_par.file.end_scope();
}
/**
* Reads the component list of a logical part mapping.
* Returns null, if an error occured.
*/
private LogicalPartMapping read_logical_part_mapping(Scanner p_scanner)
{
try
{
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("PartLibrary.read_logical_part_mapping: string expected");
return null;
}
String name = (String) next_token;
next_token = p_scanner.next_token();
if (next_token != Keyword.OPEN_BRACKET)
{
System.out.println("PartLibrary.read_logical_part_mapping: open bracket expected");
return null;
}
next_token = p_scanner.next_token();
if (next_token != Keyword.COMPONENT_SCOPE)
{
System.out.println("PartLibrary.read_logical_part_mapping: Keyword.COMPONENT_SCOPE expected");
return null;
}
java.util.SortedSet <String> result = new java.util.TreeSet<String>();
for(;;)
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
if (!(next_token instanceof String))
{
System.out.println("PartLibrary.read_logical_part_mapping: string expected");
return null;
}
result.add((String) next_token);
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("PartLibrary.read_logical_part_mapping: closing bracket expected");
return null;
}
return new LogicalPartMapping(name, result);
}
catch (java.io.IOException e)
{
System.out.println("PartLibrary.read_logical_part_mapping: IO error scanning file");
return null;
}
}
private LogicalPart read_logical_part(Scanner p_scanner)
{
java.util.Collection<PartPin> part_pins = new java.util.LinkedList<PartPin>();
Object next_token = null;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("PartLibrary.read_logical_part: IO error scanning file");
return null;
}
if (!(next_token instanceof String))
{
System.out.println("PartLibrary.read_logical_part: string expected");
return null;
}
String part_name = (String) next_token;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("PartLibrary.read_logical_part: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("PartLibrary.read_logical_part: unexpected end of file");
return null;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
boolean read_ok = true;
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.PIN)
{
PartPin curr_part_pin = read_part_pin(p_scanner);
if (curr_part_pin == null)
{
return null;
}
part_pins.add(curr_part_pin);
}
else
{
skip_scope(p_scanner);
}
}
if (!read_ok)
{
return null;
}
}
return new LogicalPart(part_name, part_pins);
}
private PartPin read_part_pin(Scanner p_scanner)
{
try
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("PartLibrary.read_part_pin: string expected");
return null;
}
String pin_name = (String) next_token;
next_token = p_scanner.next_token();
if (!(next_token instanceof Integer))
{
System.out.println("PartLibrary.read_part_pin: integer expected");
return null;
}
p_scanner.yybegin(SpecctraFileScanner.NAME);
next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("PartLibrary.read_part_pin: string expected");
return null;
}
String gate_name = (String) next_token;
next_token = p_scanner.next_token();
if (!(next_token instanceof Integer))
{
System.out.println("PartLibrary.read_part_pin: integer expected");
return null;
}
int gate_swap_code = (Integer) next_token;
p_scanner.yybegin(SpecctraFileScanner.NAME);
next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("PartLibrary.read_part_pin: string expected");
return null;
}
String gate_pin_name = (String) next_token;
next_token = p_scanner.next_token();
if (!(next_token instanceof Integer))
{
System.out.println("PartLibrary.read_part_pin: integer expected");
return null;
}
int gate_pin_swap_code = (Integer) next_token;
// overread subgates
for (;;)
{
next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
}
return new PartPin(pin_name, gate_name, gate_swap_code, gate_pin_name, gate_pin_swap_code);
}
catch (java.io.IOException e)
{
System.out.println("PartLibrary.read_part_pin: IO error scanning file");
return null;
}
}
public static class LogicalPartMapping
{
private LogicalPartMapping(String p_name, java.util.SortedSet<String> p_components)
{
name = p_name;
components = p_components;
}
/** The name of the maopping. */
public final String name;
/** The conponents belonging to the mapping. */
public final java.util.SortedSet<String> components;
}
public static class PartPin
{
private PartPin(String p_pin_name, String p_gate_name, int p_gate_swap_code,
String p_gate_pin_name, int p_gate_pin_swap_code)
{
pin_name = p_pin_name;
gate_name = p_gate_name;
gate_swap_code = p_gate_swap_code;
gate_pin_name = p_gate_pin_name;
gate_pin_swap_code = p_gate_pin_swap_code;
}
public final String pin_name;
public final String gate_name;
public final int gate_swap_code;
public final String gate_pin_name;
public final int gate_pin_swap_code;
}
public static class LogicalPart
{
private LogicalPart(String p_name, java.util.Collection<PartPin> p_part_pins)
{
name = p_name;
part_pins = p_part_pins;
}
/** The name of the maopping. */
public final String name;
/** The pins of this logical part */
public final java.util.Collection<PartPin> part_pins;
}
}

View File

@ -1,49 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Path.java
*
* Created on 30. Juni 2004, 09:28
*/
package designformats.specctra;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Class for writing path scopes from dsn-files.
*
* @author alfons
*/
public abstract class Path extends Shape
{
/** Creates a new instance of Path */
Path(Layer p_layer, double p_width, double[] p_coordinate_arr)
{
super (p_layer);
width = p_width;
coordinate_arr = p_coordinate_arr;
}
/**
* Writes this path as a scope to an output dsn-file.
*/
public abstract void write_scope(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException;
public final double width;
public final double [] coordinate_arr;
}

View File

@ -1,110 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* PlaceControl.java
*
* Created on 25. November 2004, 13:21
*/
package designformats.specctra;
/**
* Class for reading place_control scopes from dsn-files.
*
* @author Alfons Wirtz
*/
public class PlaceControl extends ScopeKeyword
{
/** Creates a new instance of PlaceControl */
public PlaceControl()
{
super("place_control");
}
/** Reads the flip_style */
public boolean read_scope(ReadScopeParameter p_par)
{
boolean flip_style_rotate_first = false;
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("PlaceControl.read_scope: IO error scanning file");
return false;
}
if (next_token == null)
{
System.out.println("PlaceControl.read_scope: unexpected end of file");
return false;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.FLIP_STYLE)
{
flip_style_rotate_first = read_flip_style_rotate_first(p_par.scanner);
}
}
}
if (flip_style_rotate_first)
{
p_par.board_handling.get_routing_board().components.set_flip_style_rotate_first(true);
}
return true;
}
/**
* Returns true, if rotate_first is read, else false.
*/
static boolean read_flip_style_rotate_first(Scanner p_scanner)
{
try
{
boolean result = false;
Object next_token = p_scanner.next_token();
if (next_token == Keyword.ROTATE_FIRST)
{
if (next_token == Keyword.ROTATE_FIRST)
{
result = true;
}
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Structure.read_flip_style: closing bracket expected");
return false;
}
return result;
}
catch (java.io.IOException e)
{
System.out.println("Structure.read_flip_style: IO error scanning file");
return false;
}
}
}

View File

@ -1,52 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Placement.java
*
* Created on 5. Juli 2004, 08:53
*/
package designformats.specctra;
/**
* Class for writing placement scopes from dsn-files.
*
* @author Alfons Wirtz
*/
public class Placement extends ScopeKeyword
{
/** Creates a new instance of Placemet */
public Placement()
{
super("placement");
}
public static void write_scope(WriteScopeParameter p_par) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("placement");
if (p_par.board.components.get_flip_style_rotate_first())
{
p_par.file.new_line();
p_par.file.write("(place_control (flip_style rotate_first))");
}
for (int i = 1; i <= p_par.board.library.packages.count(); ++i)
{
Package.write_placement_scope(p_par, p_par.board.library.packages.get(i));
}
p_par.file.end_scope();
}
}

View File

@ -1,109 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Plane.java
*
* Created on 19. Mai 2004, 08:39
*/
package designformats.specctra;
/**
* Class for reading and writing plane scopes from dsn-files.
*
* @author alfons
*/
public class Plane extends ScopeKeyword
{
/** Creates a new instance of Plane */
public Plane()
{
super("plane");
}
public boolean read_scope(ReadScopeParameter p_par)
{
// read the net name
String net_name = null;
boolean skip_window_scopes = p_par.host_cad != null && p_par.host_cad.equalsIgnoreCase("allegro");
// Cadence Allegro cutouts the pins on power planes, which leads to performance problems
// when dividing a conduction area into convex pieces.
Shape.ReadAreaScopeResult conduction_area = null;
try
{
Object next_token = p_par.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Plane.read_scope: String expected");
return false;
}
net_name = (String) next_token;
conduction_area = Shape.read_area_scope(p_par.scanner, p_par.layer_structure, skip_window_scopes);
}
catch (java.io.IOException e)
{
System.out.println("Plane.read_scope: IO error scanning file");
System.out.println(e);
return false;
}
ReadScopeParameter.PlaneInfo plane_info = new ReadScopeParameter.PlaneInfo(conduction_area, net_name);
p_par.plane_list.add(plane_info);
return true;
}
public static void write_scope(WriteScopeParameter p_par, board.ConductionArea p_conduction) throws java.io.IOException
{
int net_count = p_conduction.net_count();
if (net_count <= 0 || net_count > 1)
{
System.out.println("Plane.write_scope: unexpected net count");
return;
}
String net_name = p_par.board.rules.nets.get(p_conduction.get_net_no(0)).name;
geometry.planar.Area curr_area = p_conduction.get_area();
int layer_no = p_conduction.get_layer();
board.Layer board_layer = p_par.board.layer_structure.arr[ layer_no];
Layer plane_layer = new Layer(board_layer.name, layer_no, board_layer.is_signal);
geometry.planar.Shape boundary_shape;
geometry.planar.Shape [] holes;
if (curr_area instanceof geometry.planar.Shape)
{
boundary_shape = (geometry.planar.Shape) curr_area;
holes = new geometry.planar.Shape [0];
}
else
{
boundary_shape = curr_area.get_border();
holes = curr_area.get_holes();
}
p_par.file.start_scope();
p_par.file.write("plane ");
p_par.identifier_type.write(net_name, p_par.file);
Shape dsn_shape = p_par.coordinate_transform.board_to_dsn(boundary_shape, plane_layer);
if (dsn_shape != null)
{
dsn_shape.write_scope(p_par.file, p_par.identifier_type);
}
for (int i = 0; i < holes.length; ++i)
{
Shape dsn_hole = p_par.coordinate_transform.board_to_dsn(holes[i], plane_layer);
dsn_hole.write_hole_scope(p_par.file, p_par.identifier_type);
}
p_par.file.end_scope();
}
}

View File

@ -1,140 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Polygon.java
*
* Created on 15. Mai 2004, 08:39
*/
package designformats.specctra;
import geometry.planar.IntPoint;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Describes a polygon in a Specctra dsn file.
*
* @author alfons
*/
public class Polygon extends Shape
{
/**
* Creates a new instance of Polygon
* p_coor is an array of dimension of dimension 2 * point_count and contains x0, y0, x1, y1, ...
* If the polygon is used as rectangle,
*/
public Polygon(Layer p_layer, double[] p_coor)
{
super(p_layer);
coor = p_coor;
}
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
IntPoint [] corner_arr = new IntPoint[coor.length / 2];
double [] curr_point = new double [2];
for (int i = 0; i < corner_arr.length; ++i)
{
curr_point[0] = coor[2 * i];
curr_point[1] = coor[2 * i + 1];
corner_arr[i] = p_coordinate_transform.dsn_to_board(curr_point).round();
}
return new geometry.planar.PolygonShape(corner_arr);
}
public geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform)
{
if (coor.length < 2)
{
return geometry.planar.Simplex.EMPTY;
}
IntPoint [] corner_arr = new IntPoint[coor.length / 2];
for (int i = 0; i < corner_arr.length; ++i)
{
int curr_x = (int) Math.round(p_coordinate_transform.dsn_to_board(coor[2 * i]));
int curr_y = (int) Math.round(p_coordinate_transform.dsn_to_board(coor[2 * i + 1]));
corner_arr[i] = new IntPoint(curr_x, curr_y);
}
return new geometry.planar.PolygonShape(corner_arr);
}
public Rectangle bounding_box()
{
double[] bounds = new double[4];
bounds[0] = Integer.MAX_VALUE;
bounds[1] = Integer.MAX_VALUE;
bounds[2] = Integer.MIN_VALUE;
bounds[3] = Integer.MIN_VALUE;
for (int i = 0; i < coor.length; ++i)
{
if (i % 2 == 0)
{
// x coordinate
bounds[0] = Math.min(bounds[0], coor[i]);
bounds[2] = Math.max(bounds[2], coor[i]);
}
else
{
// x coordinate
bounds[1] = Math.min(bounds[1], coor[i]);
bounds[3] = Math.max(bounds[3], coor[i]);
}
}
return new Rectangle(layer, bounds);
}
/**
* Writes this polygon as a scope to an output dsn-file.
*/
public void write_scope(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.start_scope();
p_file.write("polygon ");
p_identifier_type.write(this.layer.name, p_file);
p_file.write(" ");
p_file.write((new Integer(0)).toString());
int corner_count = coor.length/ 2;
for (int i = 0; i < corner_count; ++i)
{
p_file.new_line();
p_file.write(new Double(coor[2 * i]).toString());
p_file.write(" ");
p_file.write(new Double(coor[2 * i + 1]).toString());
}
p_file.end_scope();
}
public void write_scope_int(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.start_scope();
p_file.write("polygon ");
p_identifier_type.write(this.layer.name, p_file);
p_file.write(" ");
p_file.write((new Integer(0)).toString());
int corner_count = coor.length/ 2;
for (int i = 0; i < corner_count; ++i)
{
p_file.new_line();
Integer curr_coor = (int) Math.round(coor[2* i ]);
p_file.write(curr_coor.toString());
p_file.write(" ");
curr_coor = (int) Math.round(coor[2* i + 1]);
p_file.write(curr_coor.toString());
}
p_file.end_scope();
}
public final double [] coor;
}

View File

@ -1,169 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Path.java
*
* Created on 24. Mai 2004, 08:10
*/
package designformats.specctra;
import geometry.planar.FloatPoint;
import geometry.planar.IntPoint;
import geometry.planar.IntOctagon;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Class for reading and writing path scopes consisting of a polygon from dsn-files.
*
* @author Alfons Wirtz
*/
public class PolygonPath extends Path
{
/** Creates a new instance of PolygonPath */
public PolygonPath(Layer p_layer, double p_width, double[] p_coordinate_arr)
{
super(p_layer, p_width, p_coordinate_arr);
}
/**
* Writes this path as a scope to an output dsn-file.
*/
public void write_scope(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.start_scope();
p_file.write("path ");
p_identifier_type.write(this.layer.name, p_file);
p_file.write(" ");
p_file.write((new Double(this.width)).toString());
int corner_count = coordinate_arr.length/ 2;
for (int i = 0; i < corner_count; ++i)
{
p_file.new_line();
p_file.write(new Double(coordinate_arr[2 * i]).toString());
p_file.write(" ");
p_file.write(new Double(coordinate_arr[2 * i + 1]).toString());
}
p_file.end_scope();
}
public void write_scope_int(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.start_scope();
p_file.write("path ");
p_identifier_type.write(this.layer.name, p_file);
p_file.write(" ");
p_file.write((new Double(this.width)).toString());
int corner_count = coordinate_arr.length/ 2;
for (int i = 0; i < corner_count; ++i)
{
p_file.new_line();
Integer curr_coor = (int) Math.round(coordinate_arr[2* i ]);
p_file.write(curr_coor.toString());
p_file.write(" ");
curr_coor = (int) Math.round(coordinate_arr[2* i + 1]);
p_file.write(curr_coor.toString());
}
p_file.end_scope();
}
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
FloatPoint [] corner_arr = new FloatPoint[this.coordinate_arr.length / 2];
double [] curr_point = new double [2];
for (int i = 0; i < corner_arr.length; ++i)
{
curr_point[0] = this.coordinate_arr[2 * i];
curr_point[1] = this.coordinate_arr[2 * i + 1];
corner_arr[i] = p_coordinate_transform.dsn_to_board(curr_point);
}
double offset = p_coordinate_transform.dsn_to_board(this.width) / 2;
if (corner_arr.length <= 2)
{
IntOctagon bounding_oct = FloatPoint.bounding_octagon(corner_arr);
return bounding_oct.enlarge(offset);
}
IntPoint [] rounded_corner_arr = new IntPoint[corner_arr.length];
for (int i = 0; i < corner_arr.length; ++i)
{
rounded_corner_arr[i] = corner_arr[i].round();
}
geometry.planar.Shape result = new geometry.planar.PolygonShape(rounded_corner_arr);
if (offset > 0)
{
result = result.bounding_tile().enlarge(offset);
}
return result;
}
public geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform)
{
FloatPoint [] corner_arr = new FloatPoint[this.coordinate_arr.length / 2];
double [] curr_point = new double [2];
for (int i = 0; i < corner_arr.length; ++i)
{
curr_point[0] = this.coordinate_arr[2 * i];
curr_point[1] = this.coordinate_arr[2 * i + 1];
corner_arr[i] = p_coordinate_transform.dsn_to_board_rel(curr_point);
}
double offset = p_coordinate_transform.dsn_to_board(this.width) / 2;
if (corner_arr.length <= 2)
{
IntOctagon bounding_oct = FloatPoint.bounding_octagon(corner_arr);
return bounding_oct.enlarge(offset);
}
IntPoint [] rounded_corner_arr = new IntPoint[corner_arr.length];
for (int i = 0; i < corner_arr.length; ++i)
{
rounded_corner_arr[i] = corner_arr[i].round();
}
geometry.planar.Shape result = new geometry.planar.PolygonShape(rounded_corner_arr);
if (offset > 0)
{
result = result.bounding_tile().enlarge(offset);
}
return result;
}
public Rectangle bounding_box()
{
double offset = this.width/2;
double[] bounds = new double[4];
bounds[0] = Integer.MAX_VALUE;
bounds[1] = Integer.MAX_VALUE;
bounds[2] = Integer.MIN_VALUE;
bounds[3] = Integer.MIN_VALUE;
for (int i = 0; i < coordinate_arr.length; ++i)
{
if (i % 2 == 0)
{
// x coordinate
bounds[0] = Math.min(bounds[0], coordinate_arr[i] - offset);
bounds[2] = Math.max(bounds[2], coordinate_arr[i]) + offset;
}
else
{
// x coordinate
bounds[1] = Math.min(bounds[1], coordinate_arr[i] - offset);
bounds[3] = Math.max(bounds[3], coordinate_arr[i] + offset);
}
}
return new Rectangle(layer, bounds);
}
}

View File

@ -1,103 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* PolylinePath.java
*
* Created on 30. Juni 2004, 08:24
*/
package designformats.specctra;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Describes a path defined by a sequence of lines (instead of a sequence of corners.
*
* @author alfons
*/
public class PolylinePath extends Path
{
/** Creates a new instance of PolylinePath */
public PolylinePath(Layer p_layer, double p_width, double[] p_corner_arr)
{
super(p_layer, p_width, p_corner_arr);
}
/**
* Writes this path as a scope to an output dsn-file.
*/
public void write_scope(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException
{
p_file.start_scope();
p_file.write("polyline_path ");
p_identifier.write(this.layer.name, p_file);
p_file.write(" ");
p_file.write((new Double(this.width)).toString());
int line_count = coordinate_arr.length/ 4;
for (int i = 0; i < line_count; ++i)
{
p_file.new_line();
for (int j = 0; j < 4; ++j)
{
p_file.write(new Double(coordinate_arr[4 * i + j]).toString());
p_file.write(" ");
}
}
p_file.end_scope();
}
public void write_scope_int(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException
{
p_file.start_scope();
p_file.write("polyline_path ");
p_identifier.write(this.layer.name, p_file);
p_file.write(" ");
p_file.write((new Double(this.width)).toString());
int line_count = coordinate_arr.length/ 4;
for (int i = 0; i < line_count; ++i)
{
p_file.new_line();
for (int j = 0; j < 4; ++j)
{
Integer curr_coor = (int) Math.round(coordinate_arr[4 * i + j]);
p_file.write(curr_coor.toString());
p_file.write(" ");
}
}
p_file.end_scope();
}
public geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform)
{
System.out.println("PolylinePath.transform_to_board_rel not implemented");
return null;
}
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
System.out.println("PolylinePath.transform_to_board_rel not implemented");
return null;
}
public Rectangle bounding_box()
{
System.out.println("PolylinePath.boundingbox not implemented");
return null;
}
}

View File

@ -1,114 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* ReadScopeParameter.java
*
* Created on 21. Juni 2004, 08:28
*/
package designformats.specctra;
import java.util.Collection;
import java.util.LinkedList;
/**
* Default parameter type used while reading a Specctra dsn-file.
*
* @author alfons
*/
public class ReadScopeParameter
{
/** Creates a new instance of ReadScopeParameter */
ReadScopeParameter(Scanner p_scanner, interactive.IBoardHandling p_board_handling,
board.BoardObservers p_observers,
datastructures.IdNoGenerator p_item_id_no_generator,board.TestLevel p_test_level)
{
scanner = p_scanner;
board_handling = p_board_handling;
observers = p_observers;
item_id_no_generator = p_item_id_no_generator;
test_level = p_test_level;
}
final Scanner scanner;
final interactive.IBoardHandling board_handling;
final NetList netlist = new NetList();
final board.BoardObservers observers;
final datastructures.IdNoGenerator item_id_no_generator;
final board.TestLevel test_level;
/** Collection of elements of class PlaneInfo.
* The plane cannot be inserted directly into the boards, because the layers may not be read completely.
*/
final Collection<PlaneInfo> plane_list = new LinkedList<PlaneInfo>();
/**
* Component placement information.
* It is filled while reading the placement scope and can be
* evaluated after reading the library and network scope.
*/
final Collection<ComponentPlacement> placement_list = new LinkedList<ComponentPlacement>();
/**
* The names of the via padstacks filled while reading the structure scope
* and evaluated after reading the library scope.
*/
Collection<String> via_padstack_names = null;
boolean via_at_smd_allowed = false;
board.AngleRestriction snap_angle = board.AngleRestriction.FORTYFIVE_DEGREE;
/** The logical parts are used for pin and gate swaw */
java.util.Collection<PartLibrary.LogicalPartMapping> logical_part_mappings
= new java.util.LinkedList<PartLibrary.LogicalPartMapping>();
java.util.Collection<PartLibrary.LogicalPart> logical_parts = new java.util.LinkedList<PartLibrary.LogicalPart>();
/** The following objects are from the parser scope. */
String string_quote = "\"";
String host_cad = null;
String host_version = null;
boolean dsn_file_generated_by_host = true;
boolean board_outline_ok = true;
final Collection<String[]> constants = new LinkedList<String[]>();
board.Communication.SpecctraParserInfo.WriteResolution write_resolution = null;
/** The following objects will be initialised when the structure scope is read. */
CoordinateTransform coordinate_transform = null;
LayerStructure layer_structure = null;
interactive.AutorouteSettings autoroute_settings = null;
board.Unit unit = board.Unit.MIL;
int resolution = 100; // default resulution
/** Information for inserting a plane */
static class PlaneInfo
{
PlaneInfo(Shape.ReadAreaScopeResult p_area, String p_net_name)
{
area = p_area;
net_name = p_net_name;
}
final Shape.ReadAreaScopeResult area;
final String net_name;
}
}

View File

@ -1,129 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Rectangle.java
*
* Created on 15. Mai 2004, 08:39
*/
package designformats.specctra;
import geometry.planar.FloatPoint;
import geometry.planar.IntBox;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Describes a rectangle in a Specctra dsn file.
*
* @author alfons
*/
public class Rectangle extends Shape
{
/**
* Creates a new instance of Rectangle
* p_coor is an array of dimension 4 and contains the rectangle coordinates
* in the following order: lower left x, lower left y, upper right x, uppper right y.
*/
public Rectangle(Layer p_layer, double[] p_coor)
{
super(p_layer);
coor = p_coor;
}
public Rectangle bounding_box()
{
return this;
}
/**
* Creates the smallest rectangle containing this rectangle and p_other
*/
public Rectangle union (Rectangle p_other)
{
double[] result_coor = new double[4];
result_coor[0] = Math.min(this.coor[0], p_other.coor[0]);
result_coor[1] = Math.min(this.coor[1], p_other.coor[1]);
result_coor[2] = Math.max(this.coor[2], p_other.coor[2]);
result_coor[3] = Math.max(this.coor[3], p_other.coor[3]);
return new Rectangle(this.layer, result_coor);
}
public geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform)
{
int box_coor[] = new int[4];
for (int i = 0; i < 4; ++i)
{
box_coor[i] = (int) Math.round(p_coordinate_transform.dsn_to_board(this.coor[i]));
}
IntBox result;
if (box_coor[1] <= box_coor[3])
{
// box_coor describe lower left and upper right corner
result = new IntBox(box_coor[0], box_coor[1], box_coor[2], box_coor[3]);
}
else
{
// box_coor describe upper left and lower right corner
result = new IntBox(box_coor[0], box_coor[3], box_coor[2], box_coor[1]);
}
return result;
}
public geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform)
{
double [] curr_point = new double [2];
curr_point[0] = Math.min(coor[0], coor[2]);
curr_point[1] = Math.min(coor[1], coor[3]);
FloatPoint lower_left = p_coordinate_transform.dsn_to_board(curr_point);
curr_point[0] = Math.max(coor[0], coor[2]);
curr_point[1] = Math.max(coor[1], coor[3]);
FloatPoint upper_right= p_coordinate_transform.dsn_to_board(curr_point);
return new IntBox(lower_left.round(), upper_right.round());
}
/**
* Writes this rectangle as a scope to an output dsn-file.
*/
public void write_scope(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException
{
p_file.new_line();
p_file.write("(rect ");
p_identifier.write(this.layer.name, p_file);
for (int i = 0; i < coor.length; ++i)
{
p_file.write(" ");
p_file.write(new Double(coor[i]).toString());
}
p_file.write(")");
}
public void write_scope_int(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException
{
p_file.new_line();
p_file.write("(rect ");
p_identifier.write(this.layer.name, p_file);
for (int i = 0; i < coor.length; ++i)
{
p_file.write(" ");
Integer curr_coor = (int) Math.round(coor[i]);
p_file.write(curr_coor.toString());
}
p_file.write(")");
}
public final double [] coor;
}

View File

@ -1,88 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Resolution.java
*
* Created on 30. Oktober 2004, 08:00
*/
package designformats.specctra;
/**
* Class for reading resolution scopes from dsn-files.
*
* @author alfons
*/
public class Resolution extends ScopeKeyword
{
/** Creates a new instance of Resolution */
public Resolution()
{
super("resolution");
}
public boolean read_scope(ReadScopeParameter p_par)
{
try
{
// read the unit
Object next_token = p_par.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Resolution.read_scope: string expected");
return false;
}
p_par.unit = board.Unit.from_string((String) next_token);
if (p_par.unit == null)
{
System.out.println("Resolution.read_scope: unit mil, inch or mm expected");
return false;
}
// read the scale factor
next_token = p_par.scanner.next_token();
if (!(next_token instanceof Integer))
{
System.out.println("Resolution.read_scope: integer expected");
return false;
}
p_par.resolution = ((Integer)next_token).intValue();
// overread the closing bracket
next_token = p_par.scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Resolution.read_scope: closing bracket expected");
return false;
}
return true;
}
catch (java.io.IOException e)
{
System.out.println("Resolution.read_scope: IO error scanning file");
return false;
}
}
public static void write_scope(datastructures.IndentFileWriter p_file, board.Communication p_board_communication) throws java.io.IOException
{
p_file.new_line();
p_file.write("(resolution ");
p_file.write(p_board_communication.unit.toString());
p_file.write(" ");
p_file.write((new Integer(p_board_communication.resolution)).toString());
p_file.write(")");
}
}

View File

@ -1,383 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Rule.java
*
* Created on 1. Juni 2004, 09:27
*/
package designformats.specctra;
import java.util.Collection;
import java.util.LinkedList;
/**
* Class for reading and writing rule scopes from dsn-files.
*
* @author Alfons Wirtz
*/
public abstract class Rule
{
/**
* Returns a collection of objects of class Rule.
*/
public static Collection<Rule> read_scope( Scanner p_scanner)
{
Collection<Rule> result = new LinkedList<Rule>();
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Rule.read_scope: IO error scanning file");
System.out.println(e);
return null;
}
if (next_token == null)
{
System.out.println("Rule.read_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
Rule curr_rule = null;
if (next_token == Keyword.WIDTH)
{
curr_rule = read_width_rule(p_scanner);
}
else if (next_token == Keyword.CLEARANCE)
{
curr_rule = read_clearance_rule(p_scanner);
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
if (curr_rule != null)
{
result.add(curr_rule);
}
}
}
return result;
}
/**
* Reads a LayerRule from dsn-file.
*/
public static LayerRule read_layer_rule_scope( Scanner p_scanner)
{
try
{
Collection<String> layer_names = new LinkedList<String>();
Collection<Rule> rule_list = new LinkedList<Rule>();
for (;;)
{
p_scanner.yybegin(SpecctraFileScanner.LAYER_NAME);
Object next_token = p_scanner.next_token();
if (next_token == Keyword.OPEN_BRACKET)
{
break;
}
if (!(next_token instanceof String))
{
System.out.println("Rule.read_layer_rule_scope: string expected");
return null;
}
layer_names.add((String) next_token);
}
for (;;)
{
Object next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
if (next_token != Keyword.RULE)
{
System.out.println("Rule.read_layer_rule_scope: rule expected");
return null;
}
rule_list.addAll(read_scope(p_scanner));
}
return new LayerRule(layer_names, rule_list);
}
catch (java.io.IOException e)
{
System.out.println("Rule.read_layer_rule_scope: IO error scanning file");
return null;
}
}
public static WidthRule read_width_rule(Scanner p_scanner)
{
try
{
double value;
Object next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
value = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
value = ((Integer) next_token).intValue();
}
else
{
System.out.println("Rule.read_width_rule: number expected");
return null;
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Rule.read_width_rule: closing bracket expected");
return null;
}
return new WidthRule(value);
}
catch (java.io.IOException e)
{
System.out.println("Rule.read_width_rule: IO error scanning file");
return null;
}
}
public static void write_scope(rules.NetClass p_net_class, WriteScopeParameter p_par) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("rule");
// write the trace width
int default_trace_half_width = p_net_class.get_trace_half_width(0);
double trace_width = 2 * p_par.coordinate_transform.board_to_dsn(default_trace_half_width);
p_par.file.new_line();
p_par.file.write("(width ");
p_par.file.write((new Double(trace_width)).toString());
p_par.file.write(")");
p_par.file.end_scope();
for (int i = 1; i < p_par.board.layer_structure.arr.length; ++i)
{
if (p_net_class.get_trace_half_width(i) != default_trace_half_width)
{
write_layer_rule(p_net_class, i, p_par);
}
}
}
private static void write_layer_rule(rules.NetClass p_net_class, int p_layer_no, WriteScopeParameter p_par) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("layer_rule ");
board.Layer curr_board_layer = p_par.board.layer_structure.arr[p_layer_no];
p_par.file.write(curr_board_layer.name);
p_par.file.start_scope();
p_par.file.write("rule ");
int curr_trace_half_width = p_net_class.get_trace_half_width(p_layer_no);
// write the trace width
double trace_width = 2 * p_par.coordinate_transform.board_to_dsn(curr_trace_half_width);
p_par.file.new_line();
p_par.file.write("(width ");
p_par.file.write((new Double(trace_width)).toString());
p_par.file.write(") ");
p_par.file.end_scope();
p_par.file.end_scope();
}
/**
* Writes the default rule as a scope to an output dsn-file.
*/
public static void write_default_rule(WriteScopeParameter p_par, int p_layer) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("rule");
// write the trace width
double trace_width = 2 * p_par.coordinate_transform.board_to_dsn(p_par.board.rules.get_default_net_class().get_trace_half_width(0));
p_par.file.new_line();
p_par.file.write("(width ");
p_par.file.write((new Double(trace_width)).toString());
p_par.file.write(")");
// write the default clearance rule
int default_cl_no = rules.BoardRules.default_clearance_class();
int default_board_clearance = p_par.board.rules.clearance_matrix.value(default_cl_no, default_cl_no, p_layer);
double default_clearance = p_par.coordinate_transform.board_to_dsn(default_board_clearance);
p_par.file.new_line();
p_par.file.write("(clear ");
p_par.file.write((new Double(default_clearance)).toString());
p_par.file.write(")");
// write the Smd_to_turn_gap
Double smd_to_turn_dist = p_par.coordinate_transform.board_to_dsn(p_par.board.rules.get_pin_edge_to_turn_dist());
p_par.file.new_line();
p_par.file.write("(clear ");
p_par.file.write(smd_to_turn_dist.toString());
p_par.file.write(" (type smd_to_turn_gap))");
int cl_count = p_par.board.rules.clearance_matrix.get_class_count();
for (int i = 1; i <= cl_count; ++i)
{
write_clearance_rules(p_par, p_layer, i, cl_count, default_board_clearance);
}
p_par.file.end_scope();
}
/**
* Write the clearance rules, which are different from the default clearance.
*/
private static void write_clearance_rules(WriteScopeParameter p_par,
int p_layer, int p_cl_class, int p_max_cl_class, int p_default_clearance) throws java.io.IOException
{
rules.ClearanceMatrix cl_matrix = p_par.board.rules.clearance_matrix;
for (int i = p_cl_class; i < p_max_cl_class; ++i)
{
int curr_board_clearance = cl_matrix.value(p_cl_class, i, p_layer);
if (curr_board_clearance == p_default_clearance)
{
continue;
}
double curr_clearance = p_par.coordinate_transform.board_to_dsn(curr_board_clearance);
p_par.file.new_line();
p_par.file.write("(clear ");
p_par.file.write((new Double(curr_clearance)).toString());
p_par.file.write(" (type ");
p_par.identifier_type.write(cl_matrix.get_name(p_cl_class), p_par.file);
p_par.file.write("_");
p_par.identifier_type.write(cl_matrix.get_name(i), p_par.file);
p_par.file.write("))");
}
}
public static ClearanceRule read_clearance_rule(Scanner p_scanner)
{
try
{
double value;
Object next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
value = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
value = ((Integer) next_token).intValue();
}
else
{
System.out.println("Rule.read_clearance_rule: number expected");
return null;
}
Collection<String> class_pairs = new LinkedList<String> ();
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
if (next_token != Keyword.OPEN_BRACKET)
{
System.out.println("Rule.read_clearance_rule: ( expected");
return null;
}
next_token = p_scanner.next_token();
if (next_token != Keyword.TYPE)
{
System.out.println("Rule.read_clearance_rule: type expected");
return null;
}
for (;;)
{
p_scanner.yybegin(SpecctraFileScanner.IGNORE_QUOTE);
next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
if (!(next_token instanceof String))
{
System.out.println("Rule.read_clearance_rule: string expected");
return null;
}
class_pairs.add((String)next_token);
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Rule.read_clearance_rule: closing bracket expected");
return null;
}
}
return new ClearanceRule(value, class_pairs);
}
catch (java.io.IOException e)
{
System.out.println("Rule.read_clearance_rule: IO error scanning file");
return null;
}
}
static public void write_item_clearance_class( String p_name, datastructures.IndentFileWriter p_file,
datastructures.IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.new_line();
p_file.write("(clearance_class ");
p_identifier_type.write(p_name, p_file);
p_file.write(")");
}
public static class WidthRule extends Rule
{
public WidthRule(double p_value)
{
value = p_value;
}
final double value;
}
public static class ClearanceRule extends Rule
{
public ClearanceRule(double p_value, Collection<String> p_class_pairs)
{
value = p_value;
clearance_class_pairs = p_class_pairs;
}
final double value;
final Collection<String> clearance_class_pairs;
}
public static class LayerRule
{
LayerRule(Collection<String> p_layer_names, Collection<Rule> p_rules)
{
layer_names = p_layer_names;
rules = p_rules;
}
final Collection<String> layer_names;
final Collection<Rule> rules;
}
}

View File

@ -1,321 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* RulesFile.java
*
* Created on 18. Juli 2005, 07:07
*
*/
package designformats.specctra;
import datastructures.IndentFileWriter;
import board.BasicBoard;
/**
* File for saving the board rules, so that they can be restored after the Board
* is creates anew from the host system.
*
* @author Alfons Wirtz
*/
public class RulesFile
{
public static void write(interactive.BoardHandling p_board_handling, java.io.OutputStream p_output_stream, String p_design_name)
{
IndentFileWriter output_file = new IndentFileWriter(p_output_stream);
BasicBoard routing_board = p_board_handling.get_routing_board();
WriteScopeParameter write_scope_parameter =
new WriteScopeParameter(routing_board, p_board_handling.settings.autoroute_settings,
output_file, routing_board.communication.specctra_parser_info.string_quote,
routing_board.communication.coordinate_transform, false);
try
{
write_rules(write_scope_parameter, p_design_name);
}
catch (java.io.IOException e)
{
System.out.println("unable to write rules to file");
}
try
{
output_file.close();
}
catch (java.io.IOException e)
{
System.out.println("unable to close rules file");
}
}
public static boolean read(java.io.InputStream p_input_stream, String p_design_name,
interactive.BoardHandling p_board_handling)
{
BasicBoard routing_board = p_board_handling.get_routing_board();
Scanner scanner = new SpecctraFileScanner(p_input_stream);
try
{
Object curr_token = scanner.next_token();
if (curr_token != Keyword.OPEN_BRACKET)
{
System.out.println("RulesFile.read: open bracket expected");
return false;
}
curr_token = scanner.next_token();
if (curr_token != Keyword.RULES)
{
System.out.println("RulesFile.read: keyword rules expected");
return false;
}
curr_token = scanner.next_token();
if (curr_token != Keyword.PCB_SCOPE)
{
System.out.println("RulesFile.read: keyword pcb expected");
return false;
}
scanner.yybegin(SpecctraFileScanner.NAME);
curr_token = scanner.next_token();
if (!(curr_token instanceof String) || !((String) curr_token).equals(p_design_name))
{
System.out.println("RulesFile.read: design_name not matching");
return false;
}
}
catch (java.io.IOException e)
{
System.out.println("RulesFile.read: IO error scanning file");
return false;
}
LayerStructure layer_structure = new LayerStructure(routing_board.layer_structure);
CoordinateTransform coordinate_transform = routing_board.communication.coordinate_transform;
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("RulesFile.read: IO error scanning file");
return false;
}
if (next_token == null)
{
System.out.println("Structure.read_scope: unexpected end of file");
return false;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
boolean read_ok = true;
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.RULE)
{
add_rules(Rule.read_scope(scanner), routing_board, null);
}
else if (next_token == Keyword.LAYER)
{
add_layer_rules(scanner, routing_board);
}
else if (next_token == Keyword.PADSTACK)
{
Library.read_padstack_scope(scanner, layer_structure, coordinate_transform, routing_board.library.padstacks);
}
else if (next_token == Keyword.VIA)
{
read_via_info(scanner, routing_board);
}
else if (next_token == Keyword.VIA_RULE)
{
read_via_rule(scanner, routing_board);
}
else if (next_token == Keyword.CLASS)
{
read_net_class(scanner, layer_structure, routing_board);
}
else if (next_token == Keyword.SNAP_ANGLE)
{
board.AngleRestriction snap_angle = Structure.read_snap_angle(scanner);
if (snap_angle != null)
{
routing_board.rules.set_trace_angle_restriction(snap_angle);
}
}
else if (next_token == Keyword.AUTOROUTE_SETTINGS)
{
interactive.AutorouteSettings autoroute_settings
= AutorouteSettings.read_scope(scanner, layer_structure);
if (autoroute_settings != null)
{
p_board_handling.settings.autoroute_settings = autoroute_settings;
}
}
else
{
ScopeKeyword.skip_scope(scanner);
}
}
if (!read_ok)
{
return false;
}
}
return true;
}
private static void write_rules( WriteScopeParameter p_par, String p_design_name) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("rules PCB ");
p_par.file.write(p_design_name);
Structure.write_snap_angle(p_par.file, p_par.board.rules.get_trace_angle_restriction());
AutorouteSettings.write_scope(p_par.file, p_par.autoroute_settings,
p_par.board.layer_structure, p_par.identifier_type);
// write the default rule using 0 as default layer.
Rule.write_default_rule(p_par, 0);
// write the via padstacks
for (int i = 1; i <= p_par.board.library.padstacks.count(); ++i)
{
library.Padstack curr_padstack = p_par.board.library.padstacks.get(i);
if (p_par.board.library.get_via_padstack(curr_padstack.name )!= null)
{
Library.write_padstack_scope(p_par, curr_padstack);
}
}
Network.write_via_infos(p_par.board.rules, p_par.file, p_par.identifier_type);
Network.write_via_rules(p_par.board.rules, p_par.file, p_par.identifier_type);
Network.write_net_classes(p_par);
p_par.file.end_scope();
}
private static void add_rules(java.util.Collection<Rule> p_rules, BasicBoard p_board, String p_layer_name)
{
int layer_no = -1;
if (p_layer_name != null)
{
layer_no = p_board.layer_structure.get_no(p_layer_name);
if (layer_no < 0)
{
System.out.println("RulesFile.add_rules: layer not found");
}
}
CoordinateTransform coordinate_transform = p_board.communication.coordinate_transform;
String string_quote = p_board.communication.specctra_parser_info.string_quote;
for (Rule curr_rule : p_rules)
{
if (curr_rule instanceof Rule.WidthRule)
{
double wire_width = ((Rule.WidthRule)curr_rule).value;
int trace_halfwidth = (int) Math.round(coordinate_transform.dsn_to_board(wire_width) / 2);
if (layer_no < 0)
{
p_board.rules.set_default_trace_half_widths(trace_halfwidth);
}
else
{
p_board.rules.set_default_trace_half_width(layer_no, trace_halfwidth);
}
}
else if (curr_rule instanceof Rule.ClearanceRule)
{
Structure.set_clearance_rule(( Rule.ClearanceRule)curr_rule, layer_no, coordinate_transform, p_board.rules, string_quote);
}
}
}
private static boolean add_layer_rules(Scanner p_scanner, BasicBoard p_board)
{
try
{
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("RulesFile.add_layer_rules: String expected");
return false;
}
String layer_string = (String) next_token;
next_token = p_scanner.next_token();
while (next_token != Keyword.CLOSED_BRACKET)
{
if (next_token != Keyword.OPEN_BRACKET)
{
System.out.println("RulesFile.add_layer_rules: ( expected");
return false;
}
next_token = p_scanner.next_token();
if (next_token == Keyword.RULE)
{
java.util.Collection<Rule> curr_rules = Rule.read_scope(p_scanner);
add_rules(curr_rules, p_board, layer_string);
}
else
{
ScopeKeyword.skip_scope(p_scanner);
}
next_token = p_scanner.next_token();
}
return true;
}
catch (java.io.IOException e)
{
System.out.println("RulesFile.add_layer_rules: IO error scanning file");
return false;
}
}
private static boolean read_via_info(Scanner p_scanner, BasicBoard p_board)
{
rules.ViaInfo curr_via_info = Network.read_via_info(p_scanner, p_board);
if (curr_via_info == null)
{
return false;
}
rules.ViaInfo existing_via = p_board.rules.via_infos.get(curr_via_info.get_name());
if (existing_via != null)
{
// replace existing via info
p_board.rules.via_infos.remove(existing_via);
}
p_board.rules.via_infos.add(curr_via_info);
return true;
}
private static boolean read_via_rule(Scanner p_scanner, BasicBoard p_board)
{
java.util.Collection<String> via_rule = Network.read_via_rule(p_scanner, p_board);
if (via_rule == null)
{
return false;
}
Network.add_via_rule(via_rule, p_board);
return true;
}
private static boolean read_net_class(Scanner p_scanner, LayerStructure p_layer_structure, BasicBoard p_board)
{
NetClass curr_class = NetClass.read_scope(p_scanner);
if (curr_class == null)
{
return false;
}
Network.insert_net_class(curr_class, p_layer_structure, p_board, p_board.communication.coordinate_transform, false);
return true;
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Scanner.java
*
* Created on 4. Juli 2004, 19:13
*/
package designformats.specctra;
/**
* Interface for scanner generated by jflex.
*
* @author alfons
*/
public interface Scanner
{
/**
* Reads the next token from the input file.
*/
Object next_token() throws java.io.IOException;
/**
* Starts a new state.
*/
void yybegin(int p_new_state);
}

View File

@ -1,127 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* ScopeKeyword.java
*
* Created on 12. Mai 2004, 08:47
*/
package designformats.specctra;
/**
*
* @author alfons
*/
/** Keywords defining a scope object*/
public class ScopeKeyword extends Keyword
{
public ScopeKeyword(String p_name)
{
super(p_name);
}
/**
* Scips the current scope while reading a dsn file.
* Returns false, if no legal scope was found.
*/
public static boolean skip_scope(Scanner p_scanner)
{
int open_bracked_count = 1;
while (open_bracked_count > 0)
{
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object curr_token = null;
try
{
curr_token = p_scanner.next_token();
}
catch (Exception e)
{
System.out.println("ScopeKeyword.skip_scope: Error while scanning file");
System.out.println(e);
return false;
}
if (curr_token == null)
{
return false; // end of file
}
if (curr_token == Keyword.OPEN_BRACKET)
{
++open_bracked_count;
}
else if (curr_token == Keyword.CLOSED_BRACKET)
{
--open_bracked_count;
}
}
return true;
}
/**
* Reads the next scope of this keyword from dsn file.
*/
public boolean read_scope(ReadScopeParameter p_par)
{
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("ScopeKeyword.read_scope: IO error scanning file");
System.out.println(e);
return false;
}
if (next_token == null)
{
// end of file
return true;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == OPEN_BRACKET)
{
ScopeKeyword next_scope;
// a new scope is expected
if (next_token instanceof ScopeKeyword)
{
next_scope = (ScopeKeyword) next_token;
if (!next_scope.read_scope(p_par))
{
return false;
}
}
else
{
// skip unknown scope
skip_scope(p_par.scanner);
}
}
}
return true;
}
}

View File

@ -1,522 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* SessionFile.java
*
* Created on 29. Oktober 2004, 08:01
*/
package designformats.specctra;
import java.util.Collection;
import java.util.Iterator;
import geometry.planar.FloatPoint;
import geometry.planar.Point;
import board.BasicBoard;
import board.PolylineTrace;
import board.Via;
import board.ConductionArea;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Methods to handle a Specctra session file.
*
* @author alfons
*/
public class SessionFile
{
/**
* Creates a Specctra session file to update the host system from the RoutingBooard
*/
public static boolean write( BasicBoard p_board, java.io.OutputStream p_output_stream, String p_design_name)
{
if (p_output_stream == null)
{
return false;
}
IndentFileWriter output_file = null;
try
{
output_file = new IndentFileWriter(p_output_stream);
}
catch (Exception e)
{
System.out.println("unable to create session file");
return false;
}
String session_name = p_design_name.replace(".dsn", ".ses");
try
{
String [] reserved_chars = {"(", ")", " ", "-"};
IdentifierType identifier_type = new IdentifierType(reserved_chars, p_board.communication.specctra_parser_info.string_quote);
write_session_scope(p_board, identifier_type, output_file, session_name, p_design_name);
}
catch (java.io.IOException e)
{
System.out.println("unable to write session file");
return false;
}
try
{
output_file.close();
}
catch (java.io.IOException e)
{
System.out.println("unable to close session file");
return false;
}
return true;
}
private static void write_session_scope(BasicBoard p_board, IdentifierType p_identifier_type,
IndentFileWriter p_file, String p_session_name, String p_design_name) throws java.io.IOException
{
double scale_factor = p_board.communication.coordinate_transform.dsn_to_board(1)/p_board.communication.resolution;
CoordinateTransform coordinate_transform = new CoordinateTransform(scale_factor, 0, 0);
p_file.start_scope();
p_file.write("session ");
p_identifier_type.write(p_session_name, p_file);
p_file.new_line();
p_file.write("(base_design ");
p_identifier_type.write(p_design_name, p_file);
p_file.write(")");
write_placement(p_board, p_identifier_type, coordinate_transform, p_file);
write_was_is(p_board, p_identifier_type, p_file);
write_routes(p_board, p_identifier_type, coordinate_transform, p_file);
p_file.end_scope();
}
public static void write_placement(BasicBoard p_board, IdentifierType p_identifier_type,
CoordinateTransform p_coordinate_transform, IndentFileWriter p_file) throws java.io.IOException
{
p_file.start_scope();
p_file.write("placement");
Resolution.write_scope(p_file, p_board.communication);
for (int i = 1; i <= p_board.library.packages.count(); ++i)
{
write_components(p_board, p_identifier_type, p_coordinate_transform, p_file, p_board.library.packages.get(i));
}
p_file.end_scope();
}
/**
* Writes all components with the package p_package to the session file.
*/
public static void write_components(BasicBoard p_board, IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file, library.Package p_package) throws java.io.IOException
{
Collection<board.Item> board_items = p_board.get_items();
boolean component_found = false;
for (int i = 1; i <= p_board.components.count(); ++i)
{
board.Component curr_component = p_board.components.get(i);
if (curr_component.get_package() == p_package)
{
// check, if not all items of the component are deleted
boolean undeleted_item_found = false;
Iterator<board.Item> it = board_items.iterator();
while (it.hasNext())
{
board.Item curr_item = it.next();
if (curr_item.get_component_no() == curr_component.no)
{
undeleted_item_found = true;
break;
}
}
if (undeleted_item_found)
{
if (!component_found)
{
// write the scope header
p_file.start_scope();
p_file.write("component ");
p_identifier_type.write(p_package.name, p_file);
component_found = true;
}
write_component(p_board, p_identifier_type, p_coordinate_transform, p_file, curr_component);
}
}
}
if (component_found)
{
p_file.end_scope();
}
}
public static void write_component(BasicBoard p_board, IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file, board.Component p_component) throws java.io.IOException
{
p_file.new_line();
p_file.write("(place ");
p_identifier_type.write(p_component.name, p_file);
double[] location = p_coordinate_transform.board_to_dsn(p_component.get_location().to_float());
Integer x_coor = (int) Math.round(location[0]);
Integer y_coor = (int) Math.round(location[1]);
p_file.write(" ");
p_file.write(x_coor.toString());
p_file.write(" ");
p_file.write(y_coor.toString());
if (p_component.placed_on_front())
{
p_file.write(" front ");
}
else
{
p_file.write(" back ");
}
int rotation = (int) Math.round(p_component.get_rotation_in_degree());
p_file.write((new Integer(rotation).toString()));
if (p_component.position_fixed)
{
p_file.new_line();
p_file.write(" (lock_type position)");
}
p_file.write(")");
}
public static void write_was_is(BasicBoard p_board, IdentifierType p_identifier_type,
IndentFileWriter p_file) throws java.io.IOException
{
p_file.start_scope();
p_file.write("was_is");
Collection<board.Pin> board_pins = p_board.get_pins();
for (board.Pin curr_pin : board_pins)
{
board.Pin swapped_with = curr_pin.get_changed_to();
if (curr_pin.get_changed_to() != curr_pin)
{
p_file.new_line();
p_file.write("(pins ");
board.Component curr_cmp = p_board.components.get(curr_pin.get_component_no());
if (curr_cmp != null)
{
p_identifier_type.write(curr_cmp.name, p_file);
p_file.write("-");
library.Package.Pin package_pin = curr_cmp.get_package().get_pin(curr_pin.get_index_in_package());
p_identifier_type.write(package_pin.name, p_file);
}
else
{
System.out.println("SessionFile.write_was_is: component not found");
}
p_file.write(" ");
board.Component swap_cmp = p_board.components.get(swapped_with.get_component_no());
if (swap_cmp != null)
{
p_identifier_type.write(swap_cmp.name, p_file);
p_file.write("-");
library.Package.Pin package_pin = swap_cmp.get_package().get_pin(swapped_with.get_index_in_package());
p_identifier_type.write(package_pin.name, p_file);
}
else
{
System.out.println("SessionFile.write_was_is: component not found");
}
p_file.write(")");
}
}
p_file.end_scope();
}
private static void write_routes(BasicBoard p_board, IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file) throws java.io.IOException
{
p_file.start_scope();
p_file.write("routes ");
Resolution.write_scope(p_file, p_board.communication);
Parser.write_scope(p_file,p_board.communication.specctra_parser_info, p_identifier_type, true);
write_library(p_board, p_identifier_type, p_coordinate_transform, p_file);
write_network(p_board, p_identifier_type, p_coordinate_transform, p_file);
p_file.end_scope();
}
private static void write_library(BasicBoard p_board, IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file) throws java.io.IOException
{
p_file.start_scope();
p_file.write("library_out ");
for (int i = 0; i < p_board.library.via_padstack_count(); ++i)
{
write_padstack(p_board.library.get_via_padstack(i), p_board, p_identifier_type, p_coordinate_transform, p_file);
}
p_file.end_scope();
}
private static void write_padstack(library.Padstack p_padstack, BasicBoard p_board, IdentifierType p_identifier_type,
CoordinateTransform p_coordinate_transform, IndentFileWriter p_file)
throws java.io.IOException
{
// search the layer range of the padstack
int first_layer_no = 0;
while (first_layer_no < p_board.get_layer_count())
{
if (p_padstack.get_shape(first_layer_no) != null)
{
break;
}
++first_layer_no;
}
int last_layer_no = p_board.get_layer_count() - 1;
while (last_layer_no >= 0 )
{
if (p_padstack.get_shape(last_layer_no) != null)
{
break;
}
--last_layer_no;
}
if (first_layer_no >= p_board.get_layer_count() || last_layer_no < 0)
{
System.out.println("SessionFile.write_padstack: padstack shape not found");
return;
}
p_file.start_scope();
p_file.write("padstack ");
p_identifier_type.write(p_padstack.name, p_file);
for (int i = first_layer_no; i <= last_layer_no; ++i)
{
geometry.planar.Shape curr_board_shape = p_padstack.get_shape(i);
if (curr_board_shape == null)
{
continue;
}
board.Layer board_layer = p_board.layer_structure.arr[i];
Layer curr_layer = new Layer(board_layer.name, i, board_layer.is_signal);
Shape curr_shape = p_coordinate_transform.board_to_dsn_rel(curr_board_shape, curr_layer);
p_file.start_scope();
p_file.write("shape");
curr_shape.write_scope_int(p_file, p_identifier_type);
p_file.end_scope();
}
if (!p_padstack.attach_allowed)
{
p_file.new_line();
p_file.write("(attach off)");
}
p_file.end_scope();
}
private static void write_network(BasicBoard p_board, IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file) throws java.io.IOException
{
p_file.start_scope();
p_file.write("network_out ");
for (int i = 1; i <= p_board.rules.nets.max_net_no(); ++i)
{
write_net(i, p_board, p_identifier_type, p_coordinate_transform, p_file);
}
p_file.end_scope();
}
private static void write_net(int p_net_no, BasicBoard p_board, IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file) throws java.io.IOException
{
Collection<board.Item> net_items = p_board.get_connectable_items(p_net_no);
boolean header_written = false;
Iterator<board.Item> it = net_items.iterator();
while (it.hasNext())
{
board.Item curr_item = it.next();
if (curr_item.get_fixed_state() == board.FixedState.SYSTEM_FIXED)
{
continue;
}
boolean is_wire = curr_item instanceof PolylineTrace;
boolean is_via = curr_item instanceof Via;
boolean is_conduction_area = curr_item instanceof ConductionArea
&& p_board.layer_structure.arr [curr_item.first_layer()].is_signal;
if (!header_written && (is_wire || is_via || is_conduction_area))
{
p_file.start_scope();
p_file.write("net ");
rules.Net curr_net = p_board.rules.nets.get(p_net_no);
if (curr_net == null)
{
System.out.println("SessionFile.write_net: net not found");
}
else
{
p_identifier_type.write(curr_net.name, p_file);
}
header_written = true;
}
if (is_wire)
{
write_wire((PolylineTrace)curr_item, p_board, p_identifier_type, p_coordinate_transform, p_file);
}
else if (is_via)
{
write_via((Via) curr_item, p_board, p_identifier_type, p_coordinate_transform, p_file);
}
else if (is_conduction_area)
{
write_conduction_area( (ConductionArea) curr_item, p_board, p_identifier_type,
p_coordinate_transform, p_file);
}
}
if (header_written)
{
p_file.end_scope();
}
}
private static void write_wire(PolylineTrace p_wire, BasicBoard p_board, IdentifierType p_identifier_type,
CoordinateTransform p_coordinate_transform, IndentFileWriter p_file) throws java.io.IOException
{
int layer_no = p_wire.get_layer();
board.Layer board_layer = p_board.layer_structure.arr[layer_no];
int wire_width = (int) Math.round(p_coordinate_transform.board_to_dsn(2 * p_wire.get_half_width()));
p_file.start_scope();
p_file.write("wire");
Point[] corner_arr = p_wire.polyline().corner_arr();
int [] coors = new int [2 * corner_arr.length];
int corner_index = 0;
int [] prev_coors = null;
for (int i = 0; i < corner_arr.length; ++i)
{
double[] curr_float_coors = p_coordinate_transform.board_to_dsn(corner_arr[i].to_float());
int [] curr_coors = new int[2];
curr_coors[0] = (int) Math.round(curr_float_coors[0]);
curr_coors[1] = (int) Math.round(curr_float_coors[1]);
if (i == 0 || ( curr_coors[0] != prev_coors[0] || curr_coors[1] != prev_coors[1]))
{
coors[corner_index] = curr_coors[0];
++corner_index;
coors[corner_index] = curr_coors[1];
++corner_index;
prev_coors = curr_coors;
}
}
if (corner_index < coors.length)
{
int [] adjusted_coors = new int[corner_index];
for (int i = 0; i < adjusted_coors.length; ++i)
{
adjusted_coors[i] = coors[i];
}
coors = adjusted_coors;
}
write_path(board_layer.name, wire_width, coors, p_identifier_type, p_file);
write_fixed_state(p_file, p_wire.get_fixed_state());
p_file.end_scope();
}
private static void write_via(Via p_via, BasicBoard p_board, IdentifierType p_identifier_type,
CoordinateTransform p_coordinate_transform, IndentFileWriter p_file) throws java.io.IOException
{
library.Padstack via_padstack = p_via.get_padstack();
FloatPoint via_location = p_via.get_center().to_float();
p_file.start_scope();
p_file.write("via ");
p_identifier_type.write(via_padstack.name, p_file);
p_file.write(" ");
double[] location = p_coordinate_transform.board_to_dsn(via_location);
Integer x_coor = (int) Math.round(location[0]);
p_file.write(x_coor.toString());
p_file.write(" ");
Integer y_coor = (int) Math.round(location[1]);
p_file.write(y_coor.toString());
write_fixed_state(p_file, p_via.get_fixed_state());
p_file.end_scope();
}
static private void write_fixed_state(IndentFileWriter p_file, board.FixedState p_fixed_state) throws java.io.IOException
{
if (p_fixed_state.ordinal() <= board.FixedState.SHOVE_FIXED.ordinal())
{
return;
}
p_file.new_line();
p_file.write("(type ");
if (p_fixed_state == board.FixedState.SYSTEM_FIXED)
{
p_file.write("fix)");
}
else
{
p_file.write("protect)");
}
}
private static void write_path(String p_layer_name, int p_width, int[] p_coors, IdentifierType p_identifier_type,
IndentFileWriter p_file)
throws java.io.IOException
{
p_file.start_scope();
p_file.write("path ");
p_identifier_type.write(p_layer_name, p_file);
p_file.write(" ");
p_file.write((new Integer(p_width)).toString());
int corner_count = p_coors.length/ 2;
for (int i = 0; i < corner_count; ++i)
{
p_file.new_line();
p_file.write(new Integer(p_coors[2 * i]).toString());
p_file.write(" ");
p_file.write(new Integer(p_coors[2 * i + 1]).toString());
}
p_file.end_scope();
}
private static void write_conduction_area( ConductionArea p_conduction_area, BasicBoard p_board,
IdentifierType p_identifier_type, CoordinateTransform p_coordinate_transform,
IndentFileWriter p_file) throws java.io.IOException
{
int net_count = p_conduction_area.net_count();
if (net_count <= 0 || net_count > 1)
{
System.out.println("SessionFile.write_conduction_area: unexpected net count");
return;
}
geometry.planar.Area curr_area = p_conduction_area.get_area();
int layer_no = p_conduction_area.get_layer();
board.Layer board_layer = p_board.layer_structure.arr[ layer_no];
Layer conduction_layer = new Layer(board_layer.name, layer_no, board_layer.is_signal);
geometry.planar.Shape boundary_shape;
geometry.planar.Shape [] holes;
if (curr_area instanceof geometry.planar.Shape)
{
boundary_shape = (geometry.planar.Shape) curr_area;
holes = new geometry.planar.Shape [0];
}
else
{
boundary_shape = curr_area.get_border();
holes = curr_area.get_holes();
}
p_file.start_scope();
p_file.write("wire ");
Shape dsn_shape = p_coordinate_transform.board_to_dsn(boundary_shape, conduction_layer);
if (dsn_shape != null)
{
dsn_shape.write_scope_int(p_file, p_identifier_type);
}
for (int i = 0; i < holes.length; ++i)
{
Shape dsn_hole = p_coordinate_transform.board_to_dsn(holes[i], conduction_layer);
dsn_hole.write_hole_scope(p_file, p_identifier_type);
}
p_file.end_scope();
}
}

View File

@ -1,738 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* SessionToEagle.java
*
* Created on 8. Dezember 2004, 07:42
*/
package designformats.specctra;
/**
* Transformes a Specctra session file into an Eagle script file.
*
* @author Alfons Wirtz
*/
public class SessionToEagle extends javax.swing.JFrame
{
public static boolean get_instance(java.io.InputStream p_session, java.io.OutputStream p_output_stream,
board.BasicBoard p_board)
{
if (p_output_stream == null)
{
return false;
}
// create a scanner for reading the session_file.
Scanner scanner = new SpecctraFileScanner(p_session);
// create a file_writer for the eagle script file.
java.io.OutputStreamWriter file_writer = new java.io.OutputStreamWriter(p_output_stream);
boolean result = true;
double board_scale_factor = p_board.communication.coordinate_transform.board_to_dsn(1);
SessionToEagle new_instance = new SessionToEagle(scanner, file_writer, p_board,
p_board.communication.unit, p_board.communication.resolution, board_scale_factor);
try
{
result = new_instance.process_session_scope();
}
catch (java.io.IOException e)
{
System.out.println("unable to process session scope");
result = false;
}
// close files
try
{
p_session.close();
file_writer.close();
}
catch (java.io.IOException e)
{
System.out.println("unable to close files");
}
return result;
}
SessionToEagle(Scanner p_scanner, java.io.OutputStreamWriter p_out_file, board.BasicBoard p_board,
board.Unit p_unit, double p_session_file_scale_dominator, double p_board_scale_factor)
{
scanner = p_scanner;
out_file = p_out_file;
board = p_board;
this.specctra_layer_structure = new LayerStructure(p_board.layer_structure);
unit = p_unit;
session_file_scale_denominator = p_session_file_scale_dominator;
board_scale_factor = p_board_scale_factor;
}
/**
* Processes the outmost scope of the session file.
* Returns false, if an error occured.
*/
private boolean process_session_scope() throws java.io.IOException
{
// read the first line of the session file
Object next_token = null;
for (int i = 0; i < 3; ++i)
{
next_token = this.scanner.next_token();
boolean keyword_ok = true;
if (i == 0)
{
keyword_ok = (next_token == Keyword.OPEN_BRACKET);
}
else if (i == 1)
{
keyword_ok = (next_token == Keyword.SESSION);
this.scanner.yybegin(SpecctraFileScanner.NAME); // to overread the name of the pcb for i = 2
}
if (!keyword_ok)
{
System.out.println("SessionToEagle.process_session_scope specctra session file format expected");
return false;
}
}
// Write the header of the eagle script file.
this.out_file.write("GRID ");
this.out_file.write(this.unit.toString());
this.out_file.write("\n");
this.out_file.write("SET WIRE_BEND 2\n");
this.out_file.write("SET OPTIMIZING OFF\n");
// Activate all layers in Eagle.
for (int i = 0; i < this.board.layer_structure.arr.length; ++i)
{
this.out_file.write("LAYER " + this.get_eagle_layer_string(i) + ";\n");
}
this.out_file.write("LAYER 17;\n");
this.out_file.write("LAYER 18;\n");
this.out_file.write("LAYER 19;\n");
this.out_file.write("LAYER 20;\n");
this.out_file.write("LAYER 23;\n");
this.out_file.write("LAYER 24;\n");
// Generate Code to remove the complete route.
// Write a bounding rectangle with GROUP (Min_X-1 Min_Y-1) (Max_X+1 Max_Y+1);
geometry.planar.IntBox board_bounding_box = this.board.get_bounding_box();
Float min_x = (float) this.board_scale_factor * (board_bounding_box.ll.x - 1);
Float min_y = (float) this.board_scale_factor * (board_bounding_box.ll.y - 1);
Float max_x = (float) this.board_scale_factor * (board_bounding_box.ur.x + 1);
Float max_y = (float) this.board_scale_factor * (board_bounding_box.ur.y + 1);
this.out_file.write("GROUP (");
this.out_file.write(min_x.toString());
this.out_file.write(" ");
this.out_file.write(min_y.toString());
this.out_file.write(") (");
this.out_file.write(max_x.toString());
this.out_file.write(" ");
this.out_file.write(max_y.toString());
this.out_file.write(");\n");
this.out_file.write("RIPUP;\n");
// read the direct subscopes of the session scope
for (;;)
{
Object prev_token = next_token;
next_token = this.scanner.next_token();
if (next_token == null)
{
// end of file
return true;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.ROUTES)
{
if (!process_routes_scope())
{
return false;
}
}
else if (next_token == Keyword.PLACEMENT_SCOPE)
{
if (!process_placement_scope())
{
return false;
}
}
else
{
// overread all scopes except the routes scope for the time being
ScopeKeyword.skip_scope(this.scanner);
}
}
}
// Wird nur einmal am Ende benoetigt!
this.out_file.write("RATSNEST\n");
return true;
}
private boolean process_placement_scope() throws java.io.IOException
{
// read the component scopes
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
next_token = this.scanner.next_token();
if (next_token == null)
{
// unexpected end of file
return false;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.COMPONENT_SCOPE)
{
if (!process_component_placement())
{
return false;
}
}
else
{
// skip unknown scope
ScopeKeyword.skip_scope(this.scanner);
}
}
}
process_swapped_pins();
return true;
}
private boolean process_component_placement() throws java.io.IOException
{
ComponentPlacement component_placement = Component.read_scope(this.scanner);
if (component_placement == null)
{
return false;
}
for (ComponentPlacement.ComponentLocation curr_location : component_placement.locations)
{
this.out_file.write("ROTATE =");
Integer rotation = (int) Math.round(curr_location.rotation);
String rotation_string;
if (curr_location.is_front)
{
rotation_string = "R" + rotation.toString();
}
else
{
rotation_string = "MR" + rotation.toString();
}
this.out_file.write(rotation_string);
this.out_file.write(" '");
this.out_file.write(curr_location.name);
this.out_file.write("';\n");
this.out_file.write("move '");
this.out_file.write(curr_location.name);
this.out_file.write("' (");
Double x_coor = curr_location.coor[0] / this.session_file_scale_denominator;
this.out_file.write(x_coor.toString());
this.out_file.write(" ");
Double y_coor = curr_location.coor[1] / this.session_file_scale_denominator;
this.out_file.write(y_coor.toString());
this.out_file.write(");\n");
}
return true;
}
private boolean process_routes_scope() throws java.io.IOException
{
// read the direct subscopes of the routes scope
boolean result = true;
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
next_token = this.scanner.next_token();
if (next_token == null)
{
// unexpected end of file
return false;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.NETWORK_OUT)
{
result = process_network_scope();
}
else
{
// skip unknown scope
ScopeKeyword.skip_scope(this.scanner);
}
}
}
return result;
}
private boolean process_network_scope() throws java.io.IOException
{
boolean result = true;
Object next_token = null;
// read the net scopes
for (;;)
{
Object prev_token = next_token;
next_token = this.scanner.next_token();
if (next_token == null)
{
// unexpected end of file
return false;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.NET)
{
result = process_net_scope();
}
else
{
// skip unknown scope
ScopeKeyword.skip_scope(this.scanner);
}
}
}
return result;
}
private boolean process_net_scope() throws java.io.IOException
{
// read the net name
Object next_token = this.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("SessionToEagle.processnet_scope: String expected");
return false;
}
String net_name = (String) next_token;
// Hier alle nicht gefixten Traces und Vias des Netz mit Namen net_name
// in der Eagle Datenhaltung loeschen.
// read the wires and vias of this net
for (;;)
{
Object prev_token = next_token;
next_token = this.scanner.next_token();
if (next_token == null)
{
// end of file
return true;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.WIRE)
{
if (!process_wire_scope(net_name))
{
return false;
}
}
else if (next_token == Keyword.VIA)
{
if (!process_via_scope(net_name))
{
return false;
}
}
else
{
ScopeKeyword.skip_scope(this.scanner);
}
}
}
return true;
}
private boolean process_wire_scope(String p_net_name) throws java.io.IOException
{
PolygonPath wire_path = null;
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
next_token = this.scanner.next_token();
if (next_token == null)
{
System.out.println("SessionToEagle.process_wire_scope: unexpected end of file");
return false;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
if (next_token == Keyword.POLYGON_PATH)
{
wire_path = Shape.read_polygon_path_scope(this.scanner, this.specctra_layer_structure);
}
else
{
ScopeKeyword.skip_scope(this.scanner);
}
}
}
if (wire_path == null)
{
// conduction areas are skipped
return true;
}
this.out_file.write("CHANGE LAYER ");
this.out_file.write(wire_path.layer.name);
this.out_file.write(";\n");
//WIRE ['signal_name'] [width] [ROUND | FLAT] [curve | @radius]
this.out_file.write("WIRE '");
this.out_file.write(p_net_name);
this.out_file.write("' ");
Double wire_width = wire_path.width / this.session_file_scale_denominator;
this.out_file.write(wire_width.toString());
this.out_file.write(" (");
for (int i = 0; i < wire_path.coordinate_arr.length; ++i)
{
Double wire_coor = wire_path.coordinate_arr[i] / this.session_file_scale_denominator;
this.out_file.write(wire_coor.toString());
if (i % 2 == 0)
{
this.out_file.write(" ");
}
else
{
if (i == wire_path.coordinate_arr.length - 1)
{
this.out_file.write(")");
}
else
{
this.out_file.write(") (");
}
}
}
this.out_file.write(";\n");
return true;
}
private boolean process_via_scope(String p_net_name) throws java.io.IOException
{
// read the padstack name
Object next_token = this.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("SessionToEagle.process_via_scope: padstack name expected");
return false;
}
String padstack_name = (String) next_token;
// read the location
double []location = new double [2];
for (int i = 0; i < 2; ++i)
{
next_token = this.scanner.next_token();
if (next_token instanceof Double)
{
location[i] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
location[i] = ((Integer) next_token).intValue();
}
else
{
System.out.println("SessionToEagle.process_via_scope: number expected");
return false;
}
}
next_token = this.scanner.next_token();
while (next_token == Keyword.OPEN_BRACKET)
{
// skip unknown scopes
ScopeKeyword.skip_scope(this.scanner);
next_token = this.scanner.next_token();
}
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("SessionToEagle.process_via_scope: closing bracket expected");
return false;
}
if (padstack_name == null)
{
System.out.println("SessionToEagle.process_via_scope: padstack_name missing");
return false;
}
library.Padstack via_padstack = this.board.library.padstacks.get(padstack_name);
if (via_padstack == null)
{
System.out.println("SessionToEagle.process_via_scope: via padstack not found");
return false;
}
geometry.planar.ConvexShape via_shape = via_padstack.get_shape(via_padstack.from_layer());
Double via_diameter = via_shape.max_width() * this.board_scale_factor;
// The Padstack name is of the form Name$drill_diameter$from_layer-to_layer
String [] name_parts = via_padstack.name.split("\\$", 3);
// example CHANGE DRILL 0.2
this.out_file.write("CHANGE DRILL ");
if (name_parts.length > 1)
{
this.out_file.write(name_parts[1]);
}
else
{
// create a default drill, because it is needed in Eagle
this.out_file.write("0.1");
}
this.out_file.write(";\n");
//VIA ['signal_name'] [diameter] [shape] [layers] [flags]
// Via Net2 0.6 round 1-4 (20.0, 222.0);
this.out_file.write("VIA '");
this.out_file.write(p_net_name);
this.out_file.write("' ");
//Durchmesser aus Padstack
this.out_file.write(via_diameter.toString());
//Shape lesen und einsetzen Square / Round / Octagon
if (via_shape instanceof geometry.planar.Circle)
{
this.out_file.write(" round ");
}
else if (via_shape instanceof geometry.planar.IntOctagon)
{
this.out_file.write(" octagon ");
}
else
{
this.out_file.write(" square ");
}
this.out_file.write(get_eagle_layer_string(via_padstack.from_layer()));
this.out_file.write("-");
this.out_file.write(get_eagle_layer_string(via_padstack.to_layer()));
this.out_file.write(" (");
Double x_coor = location[0] / this.session_file_scale_denominator;
this.out_file.write(x_coor.toString());
this.out_file.write(" ");
Double y_coor = location[1] / this.session_file_scale_denominator;
this.out_file.write(y_coor.toString());
this.out_file.write(");\n");
return true;
}
private String get_eagle_layer_string(int p_layer_no)
{
if (p_layer_no < 0 || p_layer_no >= specctra_layer_structure.arr.length)
{
return "0";
}
String [] name_pieces = this.specctra_layer_structure.arr[p_layer_no].name.split("#", 2);
return name_pieces[0];
}
private boolean process_swapped_pins() throws java.io.IOException
{
for (int i = 1; i <= this.board.components.count(); ++i)
{
if (!process_swapped_pins(i))
{
return false;
}
}
return true;
}
private boolean process_swapped_pins(int p_component_no) throws java.io.IOException
{
java.util.Collection<board.Pin> component_pins = this.board.get_component_pins(p_component_no);
boolean component_has_swapped_pins = false;
for (board.Pin curr_pin : component_pins)
{
if (curr_pin.get_changed_to() != curr_pin)
{
component_has_swapped_pins = true;
break;
}
}
if (!component_has_swapped_pins)
{
return true;
}
PinInfo[] pin_info_arr = new PinInfo[component_pins.size()];
int i = 0;
for (board.Pin curr_pin : component_pins)
{
pin_info_arr[i] = new PinInfo(curr_pin);
++i;
}
for (i = 0; i < pin_info_arr.length; ++i)
{
PinInfo curr_pin_info = pin_info_arr[i];
if (curr_pin_info.curr_changed_to != curr_pin_info.pin.get_changed_to())
{
PinInfo other_pin_info = null;
for (int j = i + 1; j < pin_info_arr.length; ++j)
{
if (pin_info_arr[j].pin.get_changed_to() == curr_pin_info.pin)
{
other_pin_info = pin_info_arr[j];
}
}
if (other_pin_info == null)
{
System.out.println("SessuinToEagle.process_swapped_pins: other_pin_info not found");
return false;
}
write_pin_swap(curr_pin_info.pin, other_pin_info.pin);
curr_pin_info.curr_changed_to = other_pin_info.pin;
other_pin_info.curr_changed_to = curr_pin_info.pin;
}
}
return true;
}
private void write_pin_swap( board.Pin p_pin_1, board.Pin p_pin_2) throws java.io.IOException
{
int layer_no = Math.max(p_pin_1.first_layer(), p_pin_2.first_layer());
String layer_name = board.layer_structure.arr[layer_no].name;
this.out_file.write("CHANGE LAYER ");
this.out_file.write(layer_name);
this.out_file.write(";\n");
double [] location_1 =
this.board.communication.coordinate_transform.board_to_dsn(p_pin_1.get_center().to_float());
double [] location_2 =
this.board.communication.coordinate_transform.board_to_dsn(p_pin_2.get_center().to_float());
this.out_file.write("PINSWAP ");
this.out_file.write(" (");
Double curr_coor = location_1[0];
this.out_file.write(curr_coor.toString());
this.out_file.write(" ");
curr_coor = location_1[1];
this.out_file.write(curr_coor.toString());
this.out_file.write(") (");
curr_coor = location_2[0];
this.out_file.write(curr_coor.toString());
this.out_file.write(" ");
curr_coor = location_2[1];
this.out_file.write(curr_coor.toString());
this.out_file.write(");\n");
}
/** The function for scanning the session file */
private final Scanner scanner;
/** The generated Eagle script file. */
private final java.io.OutputStreamWriter out_file;
/** Some information is read from the board, because it is not contained in the speccctra session file. */
private final board.BasicBoard board;
/** The layer structure in specctra format */
private final LayerStructure specctra_layer_structure;
private final board.Unit unit;
/** The scale factor for transforming coordinates from the session file to Eagle */
private final double session_file_scale_denominator;
/** The scale factor for transforming coordinates from the board to Eagle */
private final double board_scale_factor;
private static class PinInfo
{
PinInfo(board.Pin p_pin)
{
pin = p_pin;
curr_changed_to = p_pin;
}
final board.Pin pin;
board.Pin curr_changed_to;
}
}

View File

@ -1,831 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Shape.java
*
* Created on 16. Mai 2004, 11:09
*/
package designformats.specctra;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import geometry.planar.PolylineShape;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Describes a shape in a Specctra dsn file.
*
* @author alfons
*/
public abstract class Shape
{
/**
* Writes a shape scope to a Specctra dsn file.
*/
public abstract void write_scope(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException;
/**
* Writes a shape scope to a Specctra session file.
* In a session file all coordinates must be integer.
*/
public abstract void write_scope_int(IndentFileWriter p_file, IdentifierType p_identifier) throws java.io.IOException;
/**
* Reads shape scope from a Specctra dsn file.
* If p_layer_structure == null, only Layer.PCB and Layer.Signal are expected, no induvidual layers.
*/
public static final Shape read_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
Shape result = null;
try
{
Object next_token = p_scanner.next_token();
if (next_token == Keyword.OPEN_BRACKET)
{
// overread the open bracket
next_token = p_scanner.next_token();
}
if (next_token == Keyword.RECTANGLE)
{
result = Shape.read_rectangle_scope(p_scanner, p_layer_structure);
}
else if (next_token == Keyword.POLYGON)
{
result = Shape.read_polygon_scope(p_scanner, p_layer_structure);
}
else if (next_token == Keyword.CIRCLE)
{
result = Shape.read_circle_scope(p_scanner, p_layer_structure);
}
else if (next_token == Keyword.POLYGON_PATH)
{
result = Shape.read_polygon_path_scope(p_scanner, p_layer_structure);
}
else
{
// not a shape scope, skip it.
ScopeKeyword.skip_scope(p_scanner);
}
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_scope: IO error scanning file");
System.out.println(e);
return result;
}
return result;
}
/**
* Reads an object of type PolylinePath from the dsn-file.
*/
public static PolylinePath read_polyline_path_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
try
{
Layer layer = null;
Object next_token = p_scanner.next_token();
if (next_token == Keyword.PCB_SCOPE)
{
layer = Layer.PCB;
}
else if (next_token == Keyword.SIGNAL)
{
layer = Layer.SIGNAL;
}
else
{
if (p_layer_structure == null)
{
System.out.println("PolylinePath.read_scope: only layer types pcb or signal expected");
return null;
}
if (!(next_token instanceof String))
{
System.out.println("PolylinePath.read_scope: layer name string expected");
return null;
}
int layer_no = p_layer_structure.get_no((String) next_token);
if (layer_no < 0 || layer_no >= p_layer_structure.arr.length)
{
System.out.print("Shape.read_polyline_path_scope: layer name ");
System.out.print((String) next_token);
System.out.println(" not found in layer structure ");
return null;
}
layer = p_layer_structure.arr[layer_no];
}
Collection<Object> corner_list = new LinkedList<Object>();
// read the width and the corners of the path
for (;;)
{
next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
corner_list.add(next_token);
}
if (corner_list.size() < 5)
{
System.out.println("PolylinePath.read_scope: to few numbers in scope");
return null;
}
Iterator<Object> it = corner_list.iterator();
double width = 0;
Object next_object = it.next();
if (next_object instanceof Double)
{
width = ((Double) next_object).doubleValue();
}
else if (next_object instanceof Integer)
{
width = ((Integer) next_object).intValue();
}
else
{
System.out.println("PolylinePath.read_scope: number expected");
return null;
}
double[] corner_arr = new double[corner_list.size() - 1];
for (int i = 0; i < corner_arr.length; ++i)
{
next_object = it.next();
if (next_object instanceof Double)
{
corner_arr[i] = ((Double) next_object).doubleValue();
}
else if (next_object instanceof Integer)
{
corner_arr[i] = ((Integer) next_object).intValue();
}
else
{
System.out.println("Shape.read_polygon_path_scope: number expected");
return null;
}
}
return new PolylinePath(layer, width, corner_arr);
}
catch (java.io.IOException e)
{
System.out.println("PolylinePath.read_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
/**
* Reads a shape , which may contain holes from a specctra dsn-file.
* The first shape in the shape_list of the result is the border of the area.
* The other shapes in the shape_list are holes (windows).
*/
public static final ReadAreaScopeResult read_area_scope(Scanner p_scanner,
LayerStructure p_layer_structure, boolean p_skip_window_scopes)
{
Collection<Shape> shape_list = new LinkedList<Shape>();
String clearance_class_name = null;
String area_name = null;
boolean result_ok = true;
Object next_token = null;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_area_scope: IO error scanning file");
return null;
}
if (next_token instanceof String)
{
String curr_name = (String) next_token;
if (!curr_name.isEmpty())
{
area_name = curr_name;
}
}
Shape curr_shape = Shape.read_scope(p_scanner, p_layer_structure);
if (curr_shape == null)
{
result_ok = false;
}
shape_list.add(curr_shape);
next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_area_scope: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("Shape.read_area_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == Keyword.OPEN_BRACKET)
{
// a new scope is expected
if (next_token == Keyword.WINDOW && !p_skip_window_scopes)
{
Shape hole_shape = Shape.read_scope(p_scanner, p_layer_structure);
shape_list.add(hole_shape);
// overread closing bracket
try
{
next_token = p_scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_area_scope: IO error scanning file");
return null;
}
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Shape.read_area_scope: closed bracket expected");
return null;
}
}
else if (next_token == Keyword.CLEARANCE_CLASS)
{
clearance_class_name = DsnFile.read_string_scope(p_scanner);
}
else
{
// skip unknown scope
ScopeKeyword.skip_scope(p_scanner);
}
}
}
if (!result_ok)
{
return null;
}
return new ReadAreaScopeResult(area_name, shape_list, clearance_class_name);
}
/**
* Reads a rectangle scope from a Specctra dsn file.
* If p_layer_structure == null, only Layer.PCB and Layer.Signal are expected, no induvidual layers.
*/
public static Rectangle read_rectangle_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
try
{
Layer rect_layer = null;
double rect_coor[] = new double[4];
Object next_token = p_scanner.next_token();
if (next_token == Keyword.PCB_SCOPE)
{
rect_layer = Layer.PCB;
}
else if (next_token == Keyword.SIGNAL)
{
rect_layer = Layer.SIGNAL;
}
else if (p_layer_structure != null)
{
if (!(next_token instanceof String))
{
System.out.println("Shape.read_rectangle_scope: layer name string expected");
return null;
}
String layer_name = (String) next_token;
int layer_no = p_layer_structure.get_no(layer_name);
if (layer_no < 0 || layer_no >= p_layer_structure.arr.length)
{
System.out.println("Shape.read_rectangle_scope: layer name " + layer_name +
" not found in layer structure ");
}
else
{
rect_layer = p_layer_structure.arr[layer_no];
}
}
else
{
rect_layer = Layer.SIGNAL;
}
// fill the the rectangle
for (int i = 0; i < 4; ++i)
{
next_token = p_scanner.next_token();
if (next_token instanceof Double)
{
rect_coor[i] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
rect_coor[i] = ((Integer) next_token).intValue();
}
else
{
System.out.println("Shape.read_rectangle_scope: number expected");
return null;
}
}
// overread the closing bracket
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Shape.read_rectangle_scope ) expected");
return null;
}
if (rect_layer == null)
{
return null;
}
return new Rectangle(rect_layer, rect_coor);
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_rectangle_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
/**
* Reads a closed polygon scope from a Specctra dsn file.
* If p_layer_structure == null, only Layer.PCB and Layer.Signal are expected, no induvidual layers.
*/
public static Polygon read_polygon_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
try
{
Layer polygon_layer = null;
boolean layer_ok = true;
Object next_token = p_scanner.next_token();
if (next_token == Keyword.PCB_SCOPE)
{
polygon_layer = Layer.PCB;
}
else if (next_token == Keyword.SIGNAL)
{
polygon_layer = Layer.SIGNAL;
}
else
{
if (p_layer_structure == null)
{
System.out.println("Shape.read_polygon_scope: only layer types pcb or signal expected");
return null;
}
if (!(next_token instanceof String))
{
System.out.println("Shape.read_polygon_scope: layer name string expected");
return null;
}
int layer_no = p_layer_structure.get_no((String) next_token);
if (layer_no < 0 || layer_no >= p_layer_structure.arr.length)
{
System.out.print("Shape.read_polygon_scope: layer name ");
System.out.print((String) next_token);
System.out.println(" not found in layer structure ");
layer_ok = false;
}
else
{
polygon_layer = p_layer_structure.arr[layer_no];
}
}
// overread the aperture width
next_token = p_scanner.next_token();
Collection<Object> coor_list = new LinkedList<Object>();
// read the coordinates of the polygon
for (;;)
{
next_token = p_scanner.next_token();
if (next_token == null)
{
System.out.println("Shape.read_polygon_scope: unexpected end of file");
return null;
}
if (next_token == Keyword.OPEN_BRACKET)
{
// unknown scope
ScopeKeyword.skip_scope(p_scanner);
next_token = p_scanner.next_token();
}
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
coor_list.add(next_token);
}
if (!layer_ok)
{
return null;
}
double[] coor_arr = new double[coor_list.size()];
Iterator<Object> it = coor_list.iterator();
for (int i = 0; i < coor_arr.length; ++i)
{
Object next_object = it.next();
if (next_object instanceof Double)
{
coor_arr[i] = ((Double) next_object).doubleValue();
}
else if (next_object instanceof Integer)
{
coor_arr[i] = ((Integer) next_object).intValue();
}
else
{
System.out.println("Shape.read_polygon_scope: number expected");
return null;
}
}
return new Polygon(polygon_layer, coor_arr);
}
catch (java.io.IOException e)
{
System.out.println("Rectangle.read_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
/**
* Reads a circle scope from a Specctra dsn file.
*/
public static Circle read_circle_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
try
{
Layer circle_layer = null;
boolean layer_ok = true;
double circle_coor[] = new double[3];
Object next_token = p_scanner.next_token();
if (next_token == Keyword.PCB_SCOPE)
{
circle_layer = Layer.PCB;
}
else if (next_token == Keyword.SIGNAL)
{
circle_layer = Layer.SIGNAL;
}
else
{
if (p_layer_structure == null)
{
System.out.println("Shape.read_circle_scope: p_layer_structure != null expected");
return null;
}
if (!(next_token instanceof String))
{
System.out.println("Shape.read_circle_scope: string for layer_name expected");
return null;
}
int layer_no = p_layer_structure.get_no((String) next_token);
if (layer_no < 0 || layer_no >= p_layer_structure.arr.length)
{
System.out.print("Shape.read_circle_scope: layer with name ");
System.out.print((String) next_token);
System.out.println(" not found in layer stracture ");
layer_ok = false;
}
else
{
circle_layer = p_layer_structure.arr[layer_no];
}
}
// fill the the the coordinates
int curr_index = 0;
for (;;)
{
next_token = p_scanner.next_token();
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
if (curr_index > 2)
{
System.out.println("Shape.read_circle_scope: closed bracket expected");
return null;
}
if (next_token instanceof Double)
{
circle_coor[curr_index] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
circle_coor[curr_index] = ((Integer) next_token).intValue();
}
else
{
System.out.println("Shape.read_circle_scope: number expected");
return null;
}
++curr_index;
}
if (!layer_ok)
{
return null;
}
return new Circle(circle_layer, circle_coor);
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_rectangle_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
/**
* Reads an object of type Path from the dsn-file.
*/
public static PolygonPath read_polygon_path_scope(Scanner p_scanner, LayerStructure p_layer_structure)
{
try
{
Layer layer = null;
boolean layer_ok = true;
Object next_token = p_scanner.next_token();
if (next_token == Keyword.PCB_SCOPE)
{
layer = Layer.PCB;
}
else if (next_token == Keyword.SIGNAL)
{
layer = Layer.SIGNAL;
}
else
{
if (p_layer_structure == null)
{
System.out.println("Shape.read_polygon_path_scope: only layer types pcb or signal expected");
return null;
}
if (!(next_token instanceof String))
{
System.out.println("Path.read_scope: layer name string expected");
return null;
}
int layer_no = p_layer_structure.get_no((String) next_token);
if (layer_no < 0 || layer_no >= p_layer_structure.arr.length)
{
System.out.print("Shape.read_polygon_path_scope: layer with name ");
System.out.print((String) next_token);
System.out.println(" not found in layer structure ");
layer_ok = false;
}
else
{
layer = p_layer_structure.arr[layer_no];
}
}
Collection<Object> corner_list = new LinkedList<Object>();
// read the width and the corners of the path
for (;;)
{
next_token = p_scanner.next_token();
if (next_token == Keyword.OPEN_BRACKET)
{
// unknown scope
ScopeKeyword.skip_scope(p_scanner);
next_token = p_scanner.next_token();
}
if (next_token == Keyword.CLOSED_BRACKET)
{
break;
}
corner_list.add(next_token);
}
if (corner_list.size() < 5)
{
System.out.println("Shape.read_polygon_path_scope: to few numbers in scope");
return null;
}
if (!layer_ok)
{
return null;
}
Iterator<Object> it = corner_list.iterator();
double width = 0;
Object next_object = it.next();
if (next_object instanceof Double)
{
width = ((Double) next_object).doubleValue();
}
else if (next_object instanceof Integer)
{
width = ((Integer) next_object).intValue();
}
else
{
System.out.println("Shape.read_polygon_path_scope: number expected");
return null;
}
double[] coordinate_arr = new double[corner_list.size() - 1];
for (int i = 0; i < coordinate_arr.length; ++i)
{
next_object = it.next();
if (next_object instanceof Double)
{
coordinate_arr[i] = ((Double) next_object).doubleValue();
}
else if (next_object instanceof Integer)
{
coordinate_arr[i] = ((Integer) next_object).intValue();
}
else
{
System.out.println("Shape.read_polygon_path_scope: number expected");
return null;
}
}
return new PolygonPath(layer, width, coordinate_arr);
}
catch (java.io.IOException e)
{
System.out.println("Shape.read_polygon_path_scope: IO error scanning file");
System.out.println(e);
return null;
}
}
/**
* Transforms a shape with holes to the board coordinate system.
* The first shape in the Collection p_area is the border,
* the other shapes are holes of the area.
*/
public static geometry.planar.Area transform_area_to_board(Collection<Shape> p_area, CoordinateTransform p_coordinate_transform)
{
int hole_count = p_area.size() - 1;
if (hole_count <= -1)
{
System.out.println("Shape.transform_area_to_board: p_area.size() > 0 expected");
return null;
}
Iterator<Shape> it = p_area.iterator();
Shape boundary = it.next();
geometry.planar.Shape boundary_shape = boundary.transform_to_board(p_coordinate_transform);
geometry.planar.Area result;
if (hole_count == 0)
{
result = boundary_shape;
}
else
{
// Area with holes
if (!(boundary_shape instanceof geometry.planar.PolylineShape))
{
System.out.println("Shape.transform_area_to_board: PolylineShape expected");
return null;
}
PolylineShape border = (PolylineShape) boundary_shape;
PolylineShape[] holes = new PolylineShape[hole_count];
for (int i = 0; i < holes.length; ++i)
{
geometry.planar.Shape hole_shape = it.next().transform_to_board(p_coordinate_transform);
if (!(hole_shape instanceof PolylineShape))
{
System.out.println("Shape.transform_area_to_board: PolylineShape expected");
return null;
}
holes[i] = (PolylineShape) hole_shape;
}
result = new geometry.planar.PolylineArea(border, holes);
}
return result;
}
/**
* Transforms the relative coordinates of a shape with holes to the board coordinate system.
* The first shape in the Collection p_area is the border,
* the other shapes are holes of the area.
*/
public static geometry.planar.Area transform_area_to_board_rel(Collection<Shape> p_area, CoordinateTransform p_coordinate_transform)
{
int hole_count = p_area.size() - 1;
if (hole_count <= -1)
{
System.out.println("Shape.transform_area_to_board_rel: p_area.size() > 0 expected");
return null;
}
Iterator<Shape> it = p_area.iterator();
Shape boundary = it.next();
geometry.planar.Shape boundary_shape = boundary.transform_to_board_rel(p_coordinate_transform);
geometry.planar.Area result;
if (hole_count == 0)
{
result = boundary_shape;
}
else
{
// Area with holes
if (!(boundary_shape instanceof geometry.planar.PolylineShape))
{
System.out.println("Shape.transform_area_to_board_rel: PolylineShape expected");
return null;
}
PolylineShape border = (PolylineShape) boundary_shape;
PolylineShape[] holes = new PolylineShape[hole_count];
for (int i = 0; i < holes.length; ++i)
{
geometry.planar.Shape hole_shape = it.next().transform_to_board_rel(p_coordinate_transform);
if (!(hole_shape instanceof PolylineShape))
{
System.out.println("Shape.transform_area_to_board: PolylineShape expected");
return null;
}
holes[i] = (PolylineShape) hole_shape;
}
result = new geometry.planar.PolylineArea(border, holes);
}
return result;
}
public void write_hole_scope(IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.start_scope();
p_file.write("window");
this.write_scope(p_file, p_identifier_type);
p_file.end_scope();
}
/**
* Transforms a specctra dsn shape to a geometry.planar.Shape.
*/
public abstract geometry.planar.Shape transform_to_board(CoordinateTransform p_coordinate_transform);
/**
* Returns the smallest axis parallel rectangle containing this shape.
*/
public abstract Rectangle bounding_box();
/**
* Transforms the relative (vector) coordinates of a specctra dsn shape to a geometry.planar.Shape.
*/
public abstract geometry.planar.Shape transform_to_board_rel(CoordinateTransform p_coordinate_transform);
protected Shape(Layer p_layer)
{
layer = p_layer;
}
public final Layer layer;
/**
* Contains the result of the function read_area_scope.
* area_name or clearance_class_name may be null, which means they are not provided.
*/
static class ReadAreaScopeResult
{
private ReadAreaScopeResult(String p_area_name, Collection<Shape> p_shape_list, String p_clearance_class_name)
{
area_name = p_area_name;
shape_list = p_shape_list;
clearance_class_name = p_clearance_class_name;
}
String area_name; // may be generated later on, if area_name is null.
final Collection<Shape> shape_list;
final String clearance_class_name;
}
}

View File

@ -1,311 +0,0 @@
package designformats.specctra;
@SuppressWarnings("all")
%%
%class SpecctraFileScanner
%implements Scanner
%unicode
%ignorecase
%function next_token
%type Object
/* %debug */
%{
StringBuffer string = new StringBuffer();
%}
LineTerminator = \r|\n|\r\n
InputCharacter = [^\r\n]
WhiteSpace = {LineTerminator} | [ \t\f]
/* comments */
Comment = {TraditionalComment} | {EndOfLineComment}
TraditionalComment = "/*" [^*] ~"*/" | "/*" "*"+ "/"
EndOfLineComment = "#" {InputCharacter}* {LineTerminator}
Letter=[A-Za-z]
Digit=[0-9]
/* Character used for quoting string */
QuoteChar1 = \"
QuoteChar2 = '
SpecCharASCII = _|\.|\/|\\|:|#|\$|&|>|<|,|;|=|@|\[|\]||\~|\*|\?|\!|\%|\^
SpecCharANSI1 = €||ƒ|„|…|†|‡|ˆ|‰|Š||Œ|Ž|||“|”|•||—|˜|™|š||œ|ž|Ÿ
SpecCharANSI2 = [¡-ÿ]
SpecCharANSI = {SpecCharANSI1}|{SpecCharANSI2}
SpecChar1 = {SpecCharASCII}|{SpecCharANSI}
SpecChar2 = {SpecChar1}|-|\+
SpecChar3 = {SpecChar2}|{QuoteChar1}|{QuoteChar2}
SpecChar4 = {SpecChar1}|\+
SpecChar5 = {SpecChar4}|{QuoteChar1}|{QuoteChar2}
DecIntegerLiteral = ([+-]? (0 | [1-9][0-9]*))
Mantissa = ([+-]? [0-9]+ ("." [0-9]+)?)
Exponent = ([Ee] {DecIntegerLiteral})
DecFloatLiteral = {Mantissa} {Exponent}?
Identifier = ({Letter}|{SpecChar1})({Letter}|{Digit}|{SpecChar3})*
NameIdentifier = ({Letter}|{Digit}|{SpecChar2})({Letter}|{Digit}|{SpecChar3})*
IdentifierIgnoringQuotes = ({Letter}|{Digit}|{SpecChar3})*
/* to divide the component name from the pin name with the character "-" */
ComponentIdentifier = ({Letter}|{Digit}|{SpecChar4})({Letter}|{Digit}|{SpecChar5})*
/* States used for qouting strings */
%state STRING1
%state STRING2
/* The state NAME is used if the next token has to be interpreted as string, even if it is a number */
%state NAME
/* The state LAYER_NAME is used if the next token has to be interpreted as a layer name */
%state LAYER_NAME
/* To divide a component name from the pin name with the charracter "-" */
%state COMPONENT_NAME
/* Returns the next character */
%state SPEC_CHAR
/* Reads the next identifier while handling the quote characters as normal characters */
%state IGNORE_QUOTE
%%
<YYINITIAL> {
/* keywords */
"absolute" { return Keyword.ABSOLUTE; }
"active" { return Keyword.ACTIVE; }
"against_preferred_direction_trace_costs" { return Keyword.AGAINST_PREFERRED_DIRECTION_TRACE_COSTS; }
"against_prefered_direction_trace_costs" { return Keyword.AGAINST_PREFERRED_DIRECTION_TRACE_COSTS; }
"attach" { return Keyword.ATTACH; }
"autoroute" { return Keyword.AUTOROUTE; }
"autoroute_settings" { return Keyword.AUTOROUTE_SETTINGS; }
"back" { return Keyword.BACK; }
"boundary" { return Keyword.BOUNDARY; }
"circ" { yybegin(LAYER_NAME); return Keyword.CIRCLE; }
"circle" { yybegin(LAYER_NAME); return Keyword.CIRCLE; }
"circuit" { return Keyword.CIRCUIT; }
"class" { yybegin(NAME); return Keyword.CLASS; }
"class_class" { return Keyword.CLASS_CLASS; }
"classes" { return Keyword.CLASSES; }
"clear" { return Keyword.CLEARANCE; }
"clearance" { return Keyword.CLEARANCE; }
"clearance_class" { yybegin(NAME); return Keyword.CLEARANCE_CLASS; }
"comp" { yybegin(NAME); return Keyword.COMPONENT_SCOPE; }
"component" { yybegin(NAME); return Keyword.COMPONENT_SCOPE; }
"constant" { return Keyword.CONSTANT; }
"control" { return Keyword.CONTROL; }
"fanout" { return Keyword.FANOUT; }
"fix" { return Keyword.FIX; }
"fortyfive_degree" { return Keyword.FORTYFIVE_DEGREE; }
"flip_style" { return Keyword.FLIP_STYLE; }
"fromto" { return Keyword.FROMTO; }
"front" { return Keyword.FRONT; }
"generated_by_freeroute" {return Keyword.GENERATED_BY_FREEROUTE; }
"horizontal" { return Keyword.HORIZONTAL; }
"image" { yybegin(NAME); return Keyword.IMAGE; }
"host_cad" { yybegin(NAME); return Keyword.HOST_CAD; }
"host_version" { yybegin(NAME); return Keyword.HOST_VERSION; }
"keepout" { yybegin(NAME); return Keyword.KEEPOUT; }
"layer" { yybegin(NAME); return Keyword.LAYER; }
"layer_rule" { yybegin(NAME); return Keyword.LAYER_RULE; }
"length" { return Keyword.LENGTH; }
"library" { return Keyword.LIBRARY_SCOPE; }
"lock_type" { return Keyword.LOCK_TYPE; }
"logical_part" { yybegin(NAME); return Keyword.LOGICAL_PART; }
"logical_part_mapping" { yybegin(NAME); return Keyword.LOGICAL_PART_MAPPING; }
"net" { yybegin(NAME); return Keyword.NET; }
"network" { return Keyword.NETWORK_SCOPE; }
"network_out" { return Keyword.NETWORK_OUT; }
"ninety_degree" { return Keyword.NINETY_DEGREE; }
"none" { return Keyword.NONE; }
"normal" { return Keyword.NORMAL; }
"off" { return Keyword.OFF; }
"on" { return Keyword.ON; }
"order" { return Keyword.ORDER; }
"outline" { return Keyword.OUTLINE; }
"padstack" { yybegin(NAME); return Keyword.PADSTACK; }
"parser" { return Keyword.PARSER_SCOPE; }
"part_library" { return Keyword.PART_LIBRARY_SCOPE; }
"path" { yybegin(LAYER_NAME); return Keyword.POLYGON_PATH; }
"pcb" { return Keyword.PCB_SCOPE; }
"pin" { return Keyword.PIN; }
"pins" { return Keyword.PINS; }
"place" { yybegin(NAME); return Keyword.PLACE; }
"place_control" { return Keyword.PLACE_CONTROL; }
"place_keepout" { yybegin(NAME); return Keyword.PLACE_KEEPOUT; }
"placement" { return Keyword.PLACEMENT_SCOPE; }
"plane" { yybegin(NAME); return Keyword.PLANE_SCOPE; }
"plane_via_costs" { return Keyword.PLANE_VIA_COSTS; }
"poly" { yybegin(LAYER_NAME); return Keyword.POLYGON; }
"polygon" { yybegin(LAYER_NAME); return Keyword.POLYGON; }
"polyline_path" { yybegin(LAYER_NAME); return Keyword.POLYLINE_PATH; }
"position" { return Keyword.POSITION; }
"postroute" { return Keyword.POSTROUTE; }
"power" { return Keyword.POWER; }
"preferred_direction" { return Keyword.PREFERRED_DIRECTION; }
"prefered_direction" { return Keyword.PREFERRED_DIRECTION; }
"preferred_direction_trace_costs" { return Keyword.PREFERRED_DIRECTION_TRACE_COSTS; }
"prefered_direction_trace_costs" { return Keyword.PREFERRED_DIRECTION_TRACE_COSTS; }
"pull_tight" { return Keyword.PULL_TIGHT; }
"rect" { yybegin(LAYER_NAME); return Keyword.RECTANGLE; }
"rectangle" { yybegin(LAYER_NAME); return Keyword.RECTANGLE; }
"resolution" { return Keyword.RESOLUTION_SCOPE; }
"rotate" { return Keyword.ROTATE; }
"rotate_first" { return Keyword.ROTATE_FIRST; }
"routes" { return Keyword.ROUTES; }
"rule" { return Keyword.RULE; }
"rules" { return Keyword.RULES; }
"session" { return Keyword.SESSION; }
"shape" { return Keyword.SHAPE; }
"shove_fixed" { return Keyword.SHOVE_FIXED; }
"side" { return Keyword.SIDE; }
"signal" { return Keyword.SIGNAL; }
"snap_angle" { return Keyword.SNAP_ANGLE; }
"spare" { return Keyword.SPARE; }
"start_pass_no" { return Keyword.START_PASS_NO; }
"start_ripup_costs" { return Keyword.START_RIPUP_COSTS; }
"string_quote" { yybegin(IGNORE_QUOTE); return Keyword.STRING_QUOTE; }
"structure" { return Keyword.STRUCTURE_SCOPE; }
"type" { return Keyword.TYPE; }
"use_layer" { yybegin(NAME); return Keyword.USE_LAYER; }
"use_net" { yybegin(NAME); return Keyword.USE_NET; }
"use_via" { yybegin(NAME); return Keyword.USE_VIA; }
"vertical" { return Keyword.VERTICAL; }
"via" { yybegin(NAME); return Keyword.VIA; }
"vias" { return Keyword.VIAS; }
"via_at_smd" { return Keyword.VIA_AT_SMD; }
"via_costs" { return Keyword.VIA_COSTS; }
"via_keepout" { yybegin(NAME); return Keyword.VIA_KEEPOUT; }
"via_rule" { return Keyword.VIA_RULE; }
"width" { return Keyword.WIDTH; }
"window" { return Keyword.WINDOW; }
"wire" { yybegin(NAME); return Keyword.WIRE; }
"wire_keepout" { return Keyword.KEEPOUT; }
"wiring" { return Keyword.WIRING_SCOPE; }
"write_resolution" { return Keyword.WRITE_RESOLUTION; }
"(" { return Keyword.OPEN_BRACKET; }
")" { return Keyword.CLOSED_BRACKET; }
/* identifiers */
{Identifier} { return yytext(); }
/* Characters for quoting strings */
{QuoteChar1} { string.setLength(0); yybegin(STRING1); }
{QuoteChar2} { string.setLength(0); yybegin(STRING2); }
/* literals */
{DecIntegerLiteral} { return new Integer(yytext()); }
{DecFloatLiteral} { return new Double(yytext()); }
/* comments */
{Comment} { /* ignore */ }
/* whitespace */
{WhiteSpace} { /* ignore */ }
}
/* Strings quoted with " */
<STRING1> {
[^\"\\]+ { string.append( yytext() ); }
\\ { string.append('\\'); }
\" { yybegin(YYINITIAL); return string.toString(); }
}
/* Strings quotet with ' */
<STRING2> {
[^\'\\]+ { string.append( yytext() ); }
\\ { string.append('\\'); }
' { yybegin(YYINITIAL); return string.toString(); }
}
<NAME> {
/* keywords */
"(" { yybegin(YYINITIAL); return Keyword.OPEN_BRACKET;}
")" { yybegin(YYINITIAL); return Keyword.CLOSED_BRACKET;}
/* identifiers */
{NameIdentifier} { yybegin(YYINITIAL); return yytext(); }
/* Characters for quoting strings */
{QuoteChar1} { string.setLength(0); yybegin(STRING1); }
{QuoteChar2} { string.setLength(0); yybegin(STRING2); }
/* whitespace */
{WhiteSpace} { /* ignore */ }
}
/* Reads the next identifier while handling the quote characters as normal characters */
<IGNORE_QUOTE> {
/* keywords */
"(" { yybegin(YYINITIAL); return Keyword.OPEN_BRACKET;}
")" { yybegin(YYINITIAL); return Keyword.CLOSED_BRACKET;}
/* identifiers */
{IdentifierIgnoringQuotes} { yybegin(YYINITIAL); return yytext(); }
{WhiteSpace} { /* ignore */ }
}
<LAYER_NAME> {
/* keywords */
"pcb" { yybegin(YYINITIAL); return Keyword.PCB_SCOPE; }
"signal" { yybegin(YYINITIAL); return Keyword.SIGNAL; }
"(" { yybegin(YYINITIAL); return Keyword.OPEN_BRACKET;}
")" { yybegin(YYINITIAL); return Keyword.CLOSED_BRACKET;}
/* identifiers */
{NameIdentifier} { yybegin(YYINITIAL); return yytext(); }
/* Characters for quoting strings */
{QuoteChar1} { string.setLength(0); yybegin(STRING1); }
{QuoteChar2} { string.setLength(0); yybegin(STRING2); }
/* whitespace */
{WhiteSpace} { /* ignore */ }
}
/* to divide a component name from the pin name with the charracter "-" */
<COMPONENT_NAME> {
/* keywords */
"(" { yybegin(YYINITIAL); return Keyword.OPEN_BRACKET;}
")" { yybegin(YYINITIAL); return Keyword.CLOSED_BRACKET;}
/* identifiers */
{ComponentIdentifier} { yybegin(YYINITIAL); return yytext(); }
/* Characters for quoting strings */
{QuoteChar1} { string.setLength(0); yybegin(STRING1); }
{QuoteChar2} { string.setLength(0); yybegin(STRING2); }
/* whitespace */
{WhiteSpace} { /* ignore */ }
}
<SPEC_CHAR> {
{SpecChar2} {return yytext();}
}
/* error fallback */
.|\n { throw new Error("Illegal character <"+
yytext()+">"); }

View File

@ -1,786 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* Wiring.java
*
* Created on 24. Mai 2004, 07:20
*/
package designformats.specctra;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Iterator;
import datastructures.UndoableObjects;
import geometry.planar.FloatPoint;
import geometry.planar.Point;
import geometry.planar.IntBox;
import geometry.planar.IntPoint;
import geometry.planar.Line;
import geometry.planar.Polyline;
import board.RoutingBoard;
import board.Item;
import board.Via;
import board.Trace;
import board.PolylineTrace;
import board.FixedState;
import board.ItemSelectionFilter;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Class for reading and writing wiring scopes from dsn-files.
*
* @author Alfons Wirtz
*/
class Wiring extends ScopeKeyword
{
/** Creates a new instance of Wiring */
public Wiring()
{
super("wiring");
}
public boolean read_scope(ReadScopeParameter p_par)
{
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Wiring.read_scope: IO error scanning file");
return false;
}
if (next_token == null)
{
System.out.println("Wiring.read_scope: unexpected end of file");
return false;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
boolean read_ok = true;
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.WIRE)
{
read_wire_scope(p_par);
}
else if (next_token == Keyword.VIA)
{
read_ok = read_via_scope(p_par);
}
else
{
skip_scope(p_par.scanner);
}
}
if (!read_ok)
{
return false;
}
}
RoutingBoard board = p_par.board_handling.get_routing_board();
for (int i = 1; i <= board.rules.nets.max_net_no(); ++i)
{
board.normalize_traces(i);
}
return true;
}
public static void write_scope(WriteScopeParameter p_par) throws java.io.IOException
{
p_par.file.start_scope();
p_par.file.write("wiring");
// write the wires
Collection<Trace> board_wires = p_par.board.get_traces();
Iterator<Trace> it = board_wires.iterator();
while (it.hasNext())
{
write_wire_scope(p_par, it.next());
}
Collection<Via> board_vias = p_par.board.get_vias();
for (Via curr_via : board_vias)
{
write_via_scope(p_par, curr_via);
}
// write the conduction areas
Iterator<UndoableObjects.UndoableObjectNode> it2 = p_par.board.item_list.start_read_object();
for(;;)
{
Object curr_ob = p_par.board.item_list.read_object(it2);
if (curr_ob == null)
{
break;
}
if (!(curr_ob instanceof board.ConductionArea))
{
continue;
}
board.ConductionArea curr_area = (board.ConductionArea) curr_ob;
if (!(p_par.board.layer_structure.arr [curr_area.get_layer()].is_signal))
{
// This conduction areas arw written in the structure scope.
continue;
}
write_conduction_area_scope(p_par, (board.ConductionArea) curr_ob);
}
p_par.file.end_scope();
}
private static void write_via_scope(WriteScopeParameter p_par, Via p_via) throws java.io.IOException
{
library.Padstack via_padstack = p_via.get_padstack();
FloatPoint via_location = p_via.get_center().to_float();
double [] via_coor = p_par.coordinate_transform.board_to_dsn(via_location);
int net_no;
rules.Net via_net;
if (p_via.net_count() > 0)
{
net_no = p_via.get_net_no(0);
via_net = p_par.board.rules.nets.get(net_no);
}
else
{
net_no = 0;
via_net = null;
}
p_par.file.start_scope();
p_par.file.write("via ");
p_par.identifier_type.write(via_padstack.name, p_par.file);
for (int i = 0; i < via_coor.length; ++i)
{
p_par.file.write(" ");
p_par.file.write((new Double(via_coor[i])).toString());
}
if (via_net != null)
{
write_net(via_net, p_par.file, p_par.identifier_type);
}
Rule.write_item_clearance_class(p_par.board.rules.clearance_matrix.get_name(p_via.clearance_class_no()),
p_par.file, p_par.identifier_type);
write_fixed_state(p_par.file, p_via.get_fixed_state());
p_par.file.end_scope();
}
private static void write_wire_scope(WriteScopeParameter p_par, Trace p_wire) throws java.io.IOException
{
if (!(p_wire instanceof PolylineTrace))
{
System.out.println("Wiring.write_wire_scope: trace type not yet implemented");
return;
}
PolylineTrace curr_wire = (PolylineTrace) p_wire;
int layer_no = curr_wire.get_layer();
board.Layer board_layer = p_par.board.layer_structure.arr[layer_no];
Layer curr_layer = new Layer(board_layer.name, layer_no, board_layer.is_signal);
double wire_width = p_par.coordinate_transform.board_to_dsn(2 * curr_wire.get_half_width());
rules.Net wire_net = null;
if (curr_wire.net_count() > 0)
{
wire_net = p_par.board.rules.nets.get(curr_wire.get_net_no(0));
}
if (wire_net == null)
{
System.out.println("Wiring.write_wire_scope: net not found");
return;
}
p_par.file.start_scope();
p_par.file.write("wire");
if(p_par.compat_mode)
{
Point[] corner_arr = curr_wire.polyline().corner_arr();
FloatPoint[] float_corner_arr = new FloatPoint [corner_arr.length];
for (int i = 0; i < corner_arr.length; ++i)
{
float_corner_arr[i] = corner_arr[i].to_float();
}
double [] coors = p_par.coordinate_transform.board_to_dsn(float_corner_arr);
PolygonPath curr_path = new PolygonPath(curr_layer, wire_width, coors);
curr_path.write_scope(p_par.file, p_par.identifier_type);
}
else
{
double [] coors = p_par.coordinate_transform.board_to_dsn(curr_wire.polyline().arr);
PolylinePath curr_path = new PolylinePath(curr_layer, wire_width, coors);
curr_path.write_scope(p_par.file, p_par.identifier_type);
}
write_net(wire_net, p_par.file, p_par.identifier_type);
Rule.write_item_clearance_class(p_par.board.rules.clearance_matrix.get_name(p_wire.clearance_class_no()),
p_par.file, p_par.identifier_type);
write_fixed_state(p_par.file, curr_wire.get_fixed_state());
p_par.file.end_scope();
}
private static void write_conduction_area_scope(WriteScopeParameter p_par, board.ConductionArea p_conduction_area) throws java.io.IOException
{
int net_count = p_conduction_area.net_count();
if (net_count <= 0 || net_count > 1)
{
System.out.println("Plane.write_scope: unexpected net count");
return;
}
rules.Net curr_net = p_par.board.rules.nets.get(p_conduction_area.get_net_no(0));
geometry.planar.Area curr_area = p_conduction_area.get_area();
int layer_no = p_conduction_area.get_layer();
board.Layer board_layer = p_par.board.layer_structure.arr[ layer_no];
Layer conduction_layer = new Layer(board_layer.name, layer_no, board_layer.is_signal);
geometry.planar.Shape boundary_shape;
geometry.planar.Shape [] holes;
if (curr_area instanceof geometry.planar.Shape)
{
boundary_shape = (geometry.planar.Shape) curr_area;
holes = new geometry.planar.Shape [0];
}
else
{
boundary_shape = curr_area.get_border();
holes = curr_area.get_holes();
}
p_par.file.start_scope();
p_par.file.write("wire ");
Shape dsn_shape = p_par.coordinate_transform.board_to_dsn(boundary_shape, conduction_layer);
if (dsn_shape != null)
{
dsn_shape.write_scope(p_par.file, p_par.identifier_type);
}
for (int i = 0; i < holes.length; ++i)
{
Shape dsn_hole = p_par.coordinate_transform.board_to_dsn(holes[i], conduction_layer);
dsn_hole.write_hole_scope(p_par.file, p_par.identifier_type);
}
write_net(curr_net, p_par.file, p_par.identifier_type);
Rule.write_item_clearance_class(p_par.board.rules.clearance_matrix.get_name(p_conduction_area.clearance_class_no()),
p_par.file, p_par.identifier_type);
p_par.file.end_scope();
}
static private void write_net(rules.Net p_net, IndentFileWriter p_file, IdentifierType p_identifier_type) throws java.io.IOException
{
p_file.new_line();
p_file.write("(");
Net.write_net_id(p_net, p_file, p_identifier_type);
p_file.write(")");
}
static private void write_fixed_state(IndentFileWriter p_file, FixedState p_fixed_state) throws java.io.IOException
{
if (p_fixed_state == FixedState.UNFIXED)
{
return;
}
p_file.new_line();
p_file.write("(type ");
if (p_fixed_state == FixedState.SHOVE_FIXED)
{
p_file.write("shove_fixed)");
}
else if (p_fixed_state == FixedState.SYSTEM_FIXED)
{
p_file.write("fix)");
}
else
{
p_file.write("protect)");
}
}
private Item read_wire_scope(ReadScopeParameter p_par)
{
Net.Id net_id = null;
String clearance_class_name = null;
board.FixedState fixed = board.FixedState.UNFIXED;
Path path = null; // Used, if a trace is read.
Shape border_shape = null; // Used, if a conduction area is read.
Collection<Shape> hole_list = new LinkedList<Shape>();
Object next_token = null;
for (;;)
{
Object prev_token = next_token;
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Wiring.read_wire_scope: IO error scanning file");
return null;
}
if (next_token == null)
{
System.out.println("Wiring.read_wire_scope: unexpected end of file");
return null;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.POLYGON_PATH)
{
path = Shape.read_polygon_path_scope(p_par.scanner, p_par.layer_structure);
}
else if (next_token == Keyword.POLYLINE_PATH)
{
path = Shape.read_polyline_path_scope(p_par.scanner, p_par.layer_structure);
}
else if (next_token == Keyword.RECTANGLE)
{
border_shape = Shape.read_rectangle_scope(p_par.scanner, p_par.layer_structure);
}
else if (next_token == Keyword.POLYGON)
{
border_shape = Shape.read_polygon_scope(p_par.scanner, p_par.layer_structure);
}
else if (next_token == Keyword.CIRCLE)
{
border_shape = Shape.read_circle_scope(p_par.scanner, p_par.layer_structure);
}
else if (next_token == Keyword.WINDOW)
{
Shape hole_shape = Shape.read_scope(p_par.scanner, p_par.layer_structure);
hole_list.add(hole_shape);
// overread the closing bracket
try
{
next_token = p_par.scanner.next_token();
}
catch (java.io.IOException e)
{
System.out.println("Wiring.read_wire_scope: IO error scanning file");
return null;
}
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Wiring.read_wire_scope: closing bracket expected");
return null;
}
}
else if (next_token == Keyword.NET)
{
net_id = read_net_id(p_par.scanner);
}
else if (next_token == Keyword.CLEARANCE_CLASS)
{
clearance_class_name = DsnFile.read_string_scope(p_par.scanner);
}
else if (next_token == Keyword.TYPE)
{
fixed = calc_fixed(p_par.scanner);
}
else
{
skip_scope(p_par.scanner);
}
}
}
if (path == null && border_shape == null)
{
System.out.println("Wiring.read_wire_scope: shape missing");
return null;
}
RoutingBoard board = p_par.board_handling.get_routing_board();
rules.NetClass net_class = board.rules.get_default_net_class();
Collection<rules.Net> found_nets = get_subnets(net_id, board.rules);
int[] net_no_arr = new int[found_nets.size()];
int curr_index = 0;
for (rules.Net curr_net : found_nets)
{
net_no_arr[curr_index] = curr_net.net_number;
net_class = curr_net.get_class();
++curr_index;
}
int clearance_class_no = -1;
if (clearance_class_name != null)
{
clearance_class_no = board.rules.clearance_matrix.get_no(clearance_class_name);
}
int layer_no;
int half_width;
if (path != null)
{
layer_no = path.layer.no;
half_width = (int) Math.round(p_par.coordinate_transform.dsn_to_board(path.width / 2));
}
else
{
layer_no = border_shape.layer.no;
half_width = 0;
}
if (layer_no < 0 || layer_no >= board.get_layer_count())
{
System.out.print("Wiring.read_wire_scope: unexpected layer ");
if (path != null)
{
System.out.println(path.layer.name);
}
else
{
System.out.println(border_shape.layer.name);
}
return null;
}
IntBox bounding_box = board.get_bounding_box();
Item result = null;
if (border_shape != null)
{
if (clearance_class_no < 0)
{
clearance_class_no =
net_class.default_item_clearance_classes.get(rules.DefaultItemClearanceClasses.ItemClass.AREA);
}
Collection<Shape> area = new LinkedList<Shape>();
area.add(border_shape);
area.addAll(hole_list);
geometry.planar.Area conduction_area =
Shape.transform_area_to_board(area, p_par.coordinate_transform);
result = board.insert_conduction_area(conduction_area, layer_no, net_no_arr, clearance_class_no,
false, fixed);
}
else if (path instanceof PolygonPath)
{
if (clearance_class_no < 0)
{
clearance_class_no =
net_class.default_item_clearance_classes.get(rules.DefaultItemClearanceClasses.ItemClass.TRACE);
}
IntPoint [] corner_arr = new IntPoint[path.coordinate_arr.length / 2];
double [] curr_point = new double [2];
for (int i = 0; i < corner_arr.length; ++i)
{
curr_point[0] = path.coordinate_arr[2 * i];
curr_point[1] = path.coordinate_arr[2 * i + 1];
FloatPoint curr_corner = p_par.coordinate_transform.dsn_to_board(curr_point);
if (!bounding_box.contains(curr_corner))
{
System.out.println("Wiring.read_wire_scope: wire corner outside board");
return null;
}
corner_arr[i] = curr_corner.round();
}
Polyline trace_polyline = new Polyline(corner_arr);
// Traces are not yet normalized here because cycles may be removed premature.
result = board.insert_trace_without_cleaning(trace_polyline, layer_no, half_width, net_no_arr, clearance_class_no, fixed);
}
else if (path instanceof PolylinePath)
{
if (clearance_class_no < 0)
{
clearance_class_no =
net_class.default_item_clearance_classes.get(rules.DefaultItemClearanceClasses.ItemClass.TRACE);
}
Line [] line_arr = new Line[path.coordinate_arr.length / 4];
double [] curr_point = new double [2];
for (int i = 0; i < line_arr.length; ++i)
{
curr_point[0] = path.coordinate_arr[4 * i];
curr_point[1] = path.coordinate_arr[4 * i + 1];
FloatPoint curr_a = p_par.coordinate_transform.dsn_to_board(curr_point);
curr_point[0] = path.coordinate_arr[4 * i + 2];
curr_point[1] = path.coordinate_arr[4 * i + 3];
FloatPoint curr_b = p_par.coordinate_transform.dsn_to_board(curr_point);
line_arr[i] = new Line(curr_a.round(), curr_b.round());
}
Polyline trace_polyline = new Polyline(line_arr);
result = board.insert_trace_without_cleaning(trace_polyline, layer_no, half_width, net_no_arr, clearance_class_no, fixed);
}
else
{
System.out.println("Wiring.read_wire_scope: unexpected Path subclass");
return null;
}
if (result != null && result.net_count() == 0)
{
try_correct_net(result);
}
return result;
}
/**
* Maybe trace of type turret without net in Mentor design.
* Try to assig the net by calculating the overlaps.
*/
private void try_correct_net(Item p_item)
{
if (!(p_item instanceof Trace))
{
return;
}
Trace curr_trace = (Trace) p_item;
java.util.Set<Item> contacts = curr_trace.get_normal_contacts(curr_trace.first_corner(), true);
contacts.addAll(curr_trace.get_normal_contacts(curr_trace.last_corner(), true));
int corrected_net_no = 0;
for (Item curr_contact : contacts)
{
if (curr_contact.net_count() == 1)
{
corrected_net_no = curr_contact.get_net_no(0);
break;
}
}
if (corrected_net_no != 0)
{
p_item.assign_net_no(corrected_net_no);
}
}
private static Collection<rules.Net> get_subnets(Net.Id p_net_id, rules.BoardRules p_rules)
{
Collection<rules.Net> found_nets = new LinkedList<rules.Net>();
if (p_net_id != null)
{
if (p_net_id.subnet_number > 0)
{
rules.Net found_net = p_rules.nets.get(p_net_id.name, p_net_id.subnet_number);
if (found_net != null)
{
found_nets.add(found_net);
}
}
else
{
found_nets = p_rules.nets.get(p_net_id.name);
}
}
return found_nets;
}
private boolean read_via_scope(ReadScopeParameter p_par)
{
try
{
board.FixedState fixed = board.FixedState.UNFIXED;
// read the padstack name
Object next_token = p_par.scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Wiring.read_via_scope: padstack name expected");
return false;
}
String padstack_name = (String) next_token;
// read the location
double []location = new double [2];
for (int i = 0; i < 2; ++i)
{
next_token = p_par.scanner.next_token();
if (next_token instanceof Double)
{
location[i] = ((Double) next_token).doubleValue();
}
else if (next_token instanceof Integer)
{
location[i] = ((Integer) next_token).intValue();
}
else
{
System.out.println("Wiring.read_via_scope: number expected");
return false;
}
}
Net.Id net_id = null;
String clearance_class_name = null;
for (;;)
{
Object prev_token = next_token;
next_token = p_par.scanner.next_token();
if (next_token == null)
{
System.out.println("Wiring.read_via_scope: unexpected end of file");
return false;
}
if (next_token == CLOSED_BRACKET)
{
// end of scope
break;
}
if (prev_token == OPEN_BRACKET)
{
if (next_token == Keyword.NET)
{
net_id = read_net_id(p_par.scanner);
}
else if (next_token == Keyword.CLEARANCE_CLASS)
{
clearance_class_name = DsnFile.read_string_scope(p_par.scanner);
}
else if (next_token == Keyword.TYPE)
{
fixed = calc_fixed(p_par.scanner);
}
else
{
skip_scope(p_par.scanner);
}
}
}
RoutingBoard board = p_par.board_handling.get_routing_board();
library.Padstack curr_padstack = board.library.padstacks.get(padstack_name);
if (curr_padstack == null)
{
System.out.println("Wiring.read_via_scope: via padstack not found");
return false;
}
rules.NetClass net_class = board.rules.get_default_net_class();
Collection<rules.Net> found_nets = get_subnets(net_id, board.rules);
if (net_id != null && found_nets.isEmpty())
{
System.out.print("Wiring.read_via_scope: net with name ");
System.out.print(net_id.name);
System.out.println(" not found");
}
int[] net_no_arr = new int[found_nets.size()];
int curr_index = 0;
for (rules.Net curr_net : found_nets)
{
net_no_arr[curr_index] = curr_net.net_number;
net_class = curr_net.get_class();
}
int clearance_class_no = -1;
if (clearance_class_name != null)
{
clearance_class_no = board.rules.clearance_matrix.get_no(clearance_class_name);
}
if (clearance_class_no < 0)
{
clearance_class_no = net_class.default_item_clearance_classes.get(rules.DefaultItemClearanceClasses.ItemClass.VIA);
}
IntPoint board_location = p_par.coordinate_transform.dsn_to_board(location).round();
if (via_exists(board_location, curr_padstack, net_no_arr, board))
{
System.out.print("Multiple via skipped at (");
System.out.println(board_location.x + ", " + board_location.y + ")");
}
else
{
boolean attach_allowed = p_par.via_at_smd_allowed && curr_padstack.attach_allowed;
board.insert_via(curr_padstack, board_location, net_no_arr, clearance_class_no, fixed, attach_allowed);
}
return true;
}
catch (java.io.IOException e)
{
System.out.println("Wiring.read_via_scope: IO error scanning file");
return false;
}
}
private static boolean via_exists(IntPoint p_location, library.Padstack p_padstack,
int[] p_net_no_arr, board.BasicBoard p_board)
{
ItemSelectionFilter filter = new ItemSelectionFilter(ItemSelectionFilter.SelectableChoices.VIAS);
int from_layer = p_padstack.from_layer();
int to_layer = p_padstack.to_layer();
Collection<Item> picked_items = p_board.pick_items(p_location, p_padstack.from_layer(), filter);
for (Item curr_item : picked_items)
{
Via curr_via = (Via) curr_item;
if (curr_via.nets_equal(p_net_no_arr) && curr_via.get_center().equals(p_location)
&& curr_via.first_layer() == from_layer && curr_via.last_layer() == to_layer)
{
return true;
}
}
return false;
}
static board.FixedState calc_fixed(Scanner p_scanner)
{
try
{
board.FixedState result = board.FixedState.UNFIXED;
Object next_token = p_scanner.next_token();
if (next_token == Keyword.SHOVE_FIXED)
{
result = board.FixedState.SHOVE_FIXED;
}
else if (next_token == Keyword.FIX)
{
result = board.FixedState.SYSTEM_FIXED;
}
else if (next_token != Keyword.NORMAL)
{
result = board.FixedState.USER_FIXED;
}
next_token = p_scanner.next_token();
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Wiring.is_fixed: ) expected");
return board.FixedState.UNFIXED;
}
return result;
}
catch (java.io.IOException e)
{
System.out.println("Wiring.is_fixed: IO error scanning file");
return board.FixedState.UNFIXED;
}
}
/**
* Reads a net_id. The subnet_number of the net_id will be 0, if no subneet_number was found.
*/
private static Net.Id read_net_id(Scanner p_scanner)
{
try
{
int subnet_number = 0;
p_scanner.yybegin(SpecctraFileScanner.NAME);
Object next_token = p_scanner.next_token();
if (!(next_token instanceof String))
{
System.out.println("Wiring:read_net_id: String expected");
return null;
}
String net_name = (String) next_token;
next_token = p_scanner.next_token();
if (next_token instanceof Integer)
{
subnet_number = (Integer) next_token;
next_token = p_scanner.next_token();
}
if (next_token != Keyword.CLOSED_BRACKET)
{
System.out.println("Wiring.read_net_id: closing bracket expected");
}
return new Net.Id(net_name, subnet_number);
}
catch (java.io.IOException e)
{
System.out.println("DsnFile.read_string_scope: IO error scanning file");
return null;
}
}
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*
* WriteScopeParameter.java
*
* Created on 21. Juni 2004, 08:37
*/
package designformats.specctra;
import board.BasicBoard;
import datastructures.IndentFileWriter;
import datastructures.IdentifierType;
/**
* Default parameter type used while writing a Specctra dsn-file.
*
* @author alfons
*/
public class WriteScopeParameter
{
/**
* Creates a new instance of WriteScopeParameter.
* If p_compat_mode is true, only standard speecctra dsb scopes are written, so that any
* host system with an specctra interface can read them.
*/
WriteScopeParameter(BasicBoard p_board, interactive.AutorouteSettings p_autoroute_settings,
IndentFileWriter p_file, String p_string_quote, CoordinateTransform p_coordinate_transform,
boolean p_compat_mode)
{
board = p_board;
autoroute_settings = p_autoroute_settings;
file = p_file;
coordinate_transform = p_coordinate_transform;
compat_mode = p_compat_mode;
String[] reserved_chars = {"(", ")", " ", ";", "-", "_"};
identifier_type = new IdentifierType(reserved_chars, p_string_quote);
}
final BasicBoard board;
final interactive.AutorouteSettings autoroute_settings;
final IndentFileWriter file;
final CoordinateTransform coordinate_transform;
final boolean compat_mode;
final IdentifierType identifier_type;
}

View File

@ -1,21 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head><title>java.text package</title><!--
@(#)package.html 1.60 98/01/27
Copyright 1993-1997 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This software is the confidential and proprietary information of Sun
Microsystems, Inc. ("Confidential Information"). You shall not
disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement you entered into
with Sun.
CopyrightVersion 1.2
--></head>
<body bgcolor="white">
<span lang=EN-GB style="mso-ansi-language:EN-GB">Contains classes for reading and writing board designs in the Specctra dsn text format.</span>
</body></html>

View File

@ -1,10 +0,0 @@
# German version of language dependent text of the class BoardMenuInfo
title = Platinen-Layout
confirm_cancel = Bitte Abbrechen best\u00E4tigen
error_1 = Lesen der Gui-Defaults-Datei ist fehlgeschlagen
error_2 = Speichern des Platinendesigns ist fehhlgeschlagen
error_3 = Schreiberlaubnis verweigert
error_4 = Speichern des Board-Frames ist fehlgeschlagen
error_5 = Sclie\u00DFen der Output-Datei ist fehlgeschlagen
error_6 = Lesen der .dsn-Datei fehlgeschlagen
error_7 = Outline fehlt in der .dsn-Datei

View File

@ -1,10 +0,0 @@
# English version of language dependent text of the class BoardMenuInfo
title = Board Layout
confirm_cancel = Please confirm cancel
error_1 = unable to read file eu.mihosoft.freerouting.gui defaults file
error_2 = unable to save eu.mihosoft.freerouting.board to file
error_3 = sorry, no write permission
error_4 = unable to write eu.mihosoft.freerouting.board frame to file
error_5 = unable to close output file
error_6 = unable to read .dsn-file
error_7 = outline missing in .dsn-file

View File

@ -1,9 +0,0 @@
# German version of language dependent text of the class BoardMenuDisplay
display = Display
object_visibility = Objekt-Sichtbarkeit
object_visibility_tooltip = die Abbildungsintensität eines Objekts ändern
layer_visibility = Lagen-Sichtbarkeit
layer_visibility_tooltip = die Sichtbarkeit einzelner Lagen ändern
colors = Farben
colors_tooltip = Die Farben der Objekte auf der Platine ändern
miscellaneous = sonstiges

View File

@ -1,9 +0,0 @@
# English version of language dependent text of the class BoardMenuDisplay
display = Display
object_visibility = Object Visibility
object_visibility_tooltip = to change the drawing intensity of an object
layer_visibility = Layer Visibility
layer_visibility_tooltip = to change the visibility of individual layers
colors = Colors
colors_tooltip = to change the colors of the eu.mihosoft.freerouting.board objects on the screen
miscellaneous = Miscellaneous

View File

@ -1,45 +0,0 @@
# German version of language dependent text of the class BoardMenuFile
file = Datei
save = speichern
save_tooltip = speichert das Design auf Platte im internen .bin Dateiformat
save_message = Design-Datei gespeichert
save_and_exit = speichern und beenden
save_and_exit_tooltip = beendet das Programm nach Speichern des Designs auf Platte
cancel_and_exit = abbrechen und beenden
cancel_and_exit_tooltip = beendet das Programm ohne das Design zu speichern
save_as = speichern unter
save_as_tooltip = Erweiterungen .bin für binär oder .dsn für Specctra-Text-Format können verwendet werden
generate_logfile = Log-Datei erzeugen
generate_logfile_tooltip = schreibt ab jetzt die interaktiven Aktionen in eine Log-Datei
replay_logfile = Log-Datei abspielen
replay_logfile_tooltip = wiederholt die in einer Log_Datei gespeicherten interactiven Aktionen
session_file = Specctra-Session-Datei exportieren
session_file_tooltip = Schreibt eine Session-Datei im .ses-Format von Specctra
eagle_script = Eagle-Session-Script exportieren
eagle_script_tooltip = Schreibt die Änderungen im Routing in ein Eagle-Script zum Update der entsprechenden .brd-Datei in Eagle
settings = GUI-Einstellungen als Default speichern
settings_tooltip = Speichert die aktuellen Einstellungen im graphischen User-Interface als default
confirm = Möchten Sie auch die in diesem Programm erzeugten Regeln zur späteren Wiederverwendung speichern?
message_1 = Speichern der Design-Datei ist fehlgeschlagen
message_2 = die Design-Datei wird von jetzt ab gespeichert unter dem Namen
message_3 = legale Dateierweiterungen sind .bin and .dsn
message_4 = Textdatei
message_5 = im Specctra-Textformat geschrieben
message_6 = Schreiben auf Textdatei
message_7 = ist fehlgeschlagen
message_8 = Erzeugen der Log-Datei ist fehlgeschlagen.
message_9 = Schreibe Log-Datei
message_10 = Lesen der Log_datei ist fehlgeschlagen
message_11 = Session-Datei
message_12 = im Specctra-Format geschrieben
message_13 = schreibe Session-Datei
message_14 = Eagle-Script-Datei
message_15 = geschrieben
message_16 = erzeuge Eagle-Script-Datei
message_17 = GUI-Default-Einstellungen gespeichert
message_18 = Speichern der GUI-Default-Einstellungen ist fehlgeschlagen
message_19 = Speichern fehlgeschlagen da Datei nicht mit .dsn endet
message_20 = Das Host-Cad-System erwartet evtl. den Session-Dateinamen
message_21 = Bitte Datei gegebenenfalls umbenennen
message_22 = Eagle erwartet evtl. die Dateierweiterung .scr für das Script-File.

View File

@ -1,44 +0,0 @@
# English version of language dependent text of the class BoardMenuFile
file = File
save = Save
save_tooltip = saves the design to disk in the internal .bin file format
save_message = design file saved
save_and_exit = Save and Exit
save_and_exit_tooltip = exits the program after saving the design to disk
cancel_and_exit = Cancel and Exit
cancel_and_exit_tooltip = exits the program without saving the design
save_as = Save as
save_as_tooltip = use extensions .bin for binary and .dsn for Specctra text format
generate_logfile = Generate Logfile
generate_logfile_tooltip = starts writing the eu.mihosoft.freerouting.interactive actions to a logfile
replay_logfile = Replay Logfile
replay_logfile_tooltip = repeats the eu.mihosoft.freerouting.interactive actions stored in a logfile
session_file = Export Specctra Session File
session_file_tooltip = writes a session file in the Specctra .ses format
eagle_script = Export Eagle Session Script
eagle_script_tooltip = creates an eagle script to export the changes in routing
settings = Save GUI Settings as Default
settings_tooltip = saves the current settings of the graphical user interface as default
confirm = Save also the eu.mihosoft.freerouting.rules created in this program for later reuse?
message_1 = unable to save design file
message_2 = saving design file from now on as
message_3 = legal file extensions are .bin and .dsn
message_4 = textfile
message_5 = in Specctra text format written
message_6 = writing to textfile
message_7 = failed
message_8 = unable to create logfile
message_9 = writing logfile
message_10 = unable to read logfile
message_11 = session file
message_12 = in Specctra format written
message_13 = writing session file
message_14 = Eagle script file
message_15 = written
message_16 = creating Eagle script file
message_17 = GUI default settings saved
message_18 = saving GUI default settings failed
message_19 = File not saved because file extension .dsn expected
message_20 = Host cad system might expect the session file name
message_21 = Please rename the file if necessary
message_22 = Eagle might expect the script file extension .scr

View File

@ -1,5 +0,0 @@
# German version of language dependent text of the class BoardMenuHelp
help = Hilfe
contents = allgemeine Hilfe
direct_help = kontextsensitive Hilfe
about = über diese Software

View File

@ -1,5 +0,0 @@
# English version of language dependent text of the class BoardMenuHelp
help = Help
contents = Help Contents
direct_help = Help Context
about = About this Software

View File

@ -1,10 +0,0 @@
# German version of language dependent text of the class BoardMenuInfo
info = Info
incompletes = offene Verbindungen
length_violations = Längenverletzungen
clearance_violations = Clearance-Verletzungen
library_packages = Bibliotheks-Packages
library_padstacks = Bibliotheks-Padstacks
board_components = platzierte Bauteile
unconnected_route = nicht verbundener Route
route_stubs = Route-Stummel

View File

@ -1,10 +0,0 @@
# English version of language dependent text of the class BoardMenuInfo
info = Info
incompletes = Incompletes
length_violations = Length Violations
clearance_violations = Clearance Violations
library_packages = Library Packages
library_padstacks = Library Padstacks
board_components = Placed Components
unconnected_route = Unconnected Route
route_stubs = Route Stubs

View File

@ -1,4 +0,0 @@
# German version of language dependent text of the class BoardMenuOther
other = Sonstiges
snapshots = Snapshots
snapshots_tooltip = öffnet Fenster für eu.mihosoft.freerouting.interactive Snapshots

View File

@ -1,4 +0,0 @@
# English version of language dependent text of the class BoardMenuOther
other = Other
snapshots = Snapshots
snapshots_tooltip = opens window for eu.mihosoft.freerouting.interactive snapshots

View File

@ -1,6 +0,0 @@
# German version of language dependent text of the class BoardMenuParameter
parameter = Parameter
select = selektieren
route = routen
eu.mihosoft.freerouting.autoroute = autorouten
move = platzieren

View File

@ -1,6 +0,0 @@
# English version of language dependent text of the class BoardMenuParameter
parameter = Parameter
select = Select
route = Route
eu.mihosoft.freerouting.autoroute = Autoroute
move = Move

View File

@ -1,6 +0,0 @@
# German version of language dependent text of the class BoardMenuRules
eu.mihosoft.freerouting.rules = Regeln
clearance_matrix = Clearance-Matrix
vias = Vias
nets = Netze
net_classes = Netzklassen

View File

@ -1,6 +0,0 @@
# English version of language dependent text of the class BoardMenuRules
eu.mihosoft.freerouting.rules = Rules
clearance_matrix = Clearance Matrix
vias = Vias
nets = Nets
net_classes = Net Classes

View File

@ -1,5 +0,0 @@
# German version of language dependent text of the class BoardPanelStatus
status_line = Statuszeile
additional_text_field = zusätzliches Textfeld
current_layer = aktuelle Lage: Bauteil-Seite
cursor = Cursor:

View File

@ -1,5 +0,0 @@
# English version of language dependent text of the class BoardPanelStatus
status_line = status line
additional_text_field = additional text field
current_layer = current layer: Component Side
cursor = cursor:

View File

@ -1,43 +0,0 @@
# German version of language dependent text of the class BoardToolbarSelectedItem
info = Info
info_tooltip = zeigt Informationen \u00FCber die ausgew\u00E4hlten Objekte (i)
cancel = Abbrechen
cancel_tooltip = das Auswahlmen\u00FC verlassen (Esc)
delete = L\u00F6schen
delete_tooltip = die unfixierten ausgew\u00E4hlten Objekte l\u00F6schen (Entf)
cutout = Ausschneiden
cutout_tooltip = den ausgew\u00E4hlten Route innerhalb eines Rechtecks l\u00F6schen (d)
fix = Fix
fix_tooltip = die ausgew\u00E4hlten Objekte fixieren (f)
unfix = Unfix
unfix_tooltip = die Fixierung der ausgew\u00E4hlten Objekte aufheben (u)
spacing = Clearance
spacing_tooltip = den ausgew\u00E4hlten Objekten eine neue Clearance-Klasse zuweisen
pull_tight = Gl\u00E4tten
pull_tight_tooltip = Die ausgew\u00E4hlten Bahnen und Vias glattt ziehen (p)
eu.mihosoft.freerouting.autoroute = Autoroute
autoroute_tooltip = die ausgew\u00E4hlten Objekte autorouten (a)
fanout = Fanout
fanout_tooltip = die ausgew\u00E4hlten SMD-Pins bis zum ersten Via autorouten
nets = Netze
nets_tooltip = die Auswahl auf ganze Netze erweitern (n)
conn_sets = Zush.
conn_sets_tooltip = die Auswahl auf ganze zusammenh\u00E4ngende Teilmengen erweitern (s)
connections = Verb.
connections_tooltip = die Auswahl auf ganze Verbindungen erweitern (e)
components = Bauteile
components_tooltip = die Auswahl auf ganze Bauteile erweitern (b)
new_net = Neues Netz
new_net_tooltip = die ausgew\u00E4hlten Objekte einem neuen Netz zuweisen
new_component = Neues Bauteil
new_component_tooltip = die ausgew\u00E4hlten Objekte einem neuen Bauteil zuweisen
violations = Verletzungen
violations_tooltip = Das Zeigen der Clearance-Verletzungen der ausgew\u00E4hlten Objekte an- oder abschalten (v)
zoom_selection = Auswahl abbilden
zoom_selection_tooltip = ein umgebendes Rechteck der ausgew\u00E4hlten Objekte abbilden(w)
zoom_all = Alles abb.
zoom_all_tooltip = die gesamte Platine abbilden (a)
zoom_region = Ausschnitt abb.
zoom_region_tooltip = ein Rechteck der Platine zum Abbilden ausw\u00E4hlen (r)
select_clearance_class = W\u00E4hle Clearance-Klasse
assign_clearance_class = Clearance-Klasse zuweisen

View File

@ -1,43 +0,0 @@
# English version of language dependent text of the class BoardToolbarSelectedItem
info = Info
info_tooltip = displays information about the selected items (i)
cancel = Cancel
cancel_tooltip = to cancel the current selection (esc)
delete = Delete
delete_tooltip = to delete the selected items which are not fixed (del)
cutout = Cutout
cutout_tooltip = to delete the selected route inside a rectangle (d)
fix = Fix
fix_tooltip = to fix the selected items (f)
unfix = Unfix
unfix_tooltip = to unfix the selected items (u)
spacing = Clearance
spacing_tooltip = to assign a new clearance class to the selected items
pull_tight = Pull Tight
pull_tight_tooltip = to optimize the selected traces and vias (p)
eu.mihosoft.freerouting.autoroute = Autoroute
autoroute_tooltip = to eu.mihosoft.freerouting.autoroute the selected items (a)
fanout = Fanout
fanout_tooltip = to eu.mihosoft.freerouting.autoroute the selected SMD pins until the first via
nets = Nets
nets_tooltip = to extend the selection to whole nets (n)
conn_sets = Conn. Sets
conn_sets_tooltip = to extend the selection to whole connected sets (s)
connections = Connections
connections_tooltip = to extend the selection until the next fork or terminal item (e)
components = Components
components_tooltip = to extend the selection to whole components (b)
new_net = New Net
new_net_tooltip = to assign the selected items to a new net
new_component = New Component
new_component_tooltip = to assign the selected items to a new component
violations = Violations
violations_tooltip = to show or hide the clearance violations of the selected items (v)
zoom_selection = Zoom Selection
zoom_selection_tooltip = to display a window containing the selected items (w)
zoom_all = Zoom All
zoom_all_tooltip = to display the whole eu.mihosoft.freerouting.board (a)
zoom_region = Zoom Region
zoom_region_tooltip = to display a region of the eu.mihosoft.freerouting.board (r)
select_clearance_class = Select clearance class
assign_clearance_class = Assign Clearance Class

View File

@ -1,22 +0,0 @@
# German Version of language dependent text of the eu.mihosoft.freerouting.board toolbar
select_button = Selektieren
select_button_tooltip = linke Maustaste selektiert Objekte (s)
route_button = Routen
route_button_tooltip = linke Maustaste beginnt eine neue Bahn (r)
drag_button = Ziehen
drag_button_tooltip = Objekte mit gedr\u00FCckter linker Maustaste ziehen oder Bahnen vom leeren Raum aus schieben(d)
undo_button = Undo
undo_button_tooltip = die letzte \u00C4nderung r\u00FCckg\u00E4ngig machen (u)
redo_button = Redo
redo_button_tooltip = die letzte \u00C4nderung wiederherstellen (b)
incompletes_button = Incompletes
incompletes_button_tooltip = das Zeigen der offenen Verbindungen an- oder abschalten (g)
violations_button = Verletzungen
violations_button_tooltip = das Zeigen der Clearance-Verletzungen an- oder abschalten (v)
autoroute_button = Autorouter
autoroute_button_tooltip = den Batch-Autorouter starten
display_all_button = Alles abbilden
display_all_button_tooltip = die gesamte Platine abbilden (a)
display_region_button = Ausschnitt abbilden
display_region_button_tooltip = ein Rechteck der Platine zum Abbilden ausw\u00E4hlen (f)
unit_button = Unit:

View File

@ -1,23 +0,0 @@
# English version of language dependent text of the eu.mihosoft.freerouting.board toolbar
select_button = Select
select_button_tooltip = left button selects items (s)
route_button = Route
route_button_tooltip = left button starts a new trace (r)
drag_button = Drag
drag_button_tooltip = to drag items with the left button or to push traces out of empty space (d)
undo_button = Undo
undo_button_tooltip = to undo the last change (u)
redo_button = Redo
redo_button_tooltip = to redo the last change (b)
incompletes_button = Incompletes
incompletes_button_tooltip = to display or hide the incomplete connections (g)
violations_button = Violations
violations_button_tooltip = to display or hide the clearance violations (v)
autoroute_button = Autorouter
autoroute_button_tooltip = to start the batch autorouter
display_all_button = Zoom All
display_all_button_tooltip = to display the whole eu.mihosoft.freerouting.board (a)
display_region_button = Zoom Region
display_region_button_tooltip = to select a region of the eu.mihosoft.freerouting.board for display(f)
unit_button = Unit:

View File

@ -1,13 +0,0 @@
# German version of language dependent text of the cleanup windows in the info menu
at = bei
net = Netz
no_route_stubs_found = keine Route-Stummel gefunden
no_unconnected_route_found = keine nicht verbundenen Traces oder Vias gefunden
on_layer = auf Lage
route_stubs = Route-Stummel
stub_net = Stummel Netz
trace = Trace
trace_count = Trace-Anzahl
unconnected_route = Nicht verbundener Route
via = Via
via_count = Via-Anzahl

View File

@ -1,13 +0,0 @@
# English version of language dependent text of the cleanup windows in the info menu
at = at
net = Net
no_route_stubs_found = no route stubs found
no_unconnected_route_found = no unconnected traces or vias found
on_layer = on layer
route_stubs = Route Stubs
stub_net = stub net
trace = Trace
trace_count = trace count
unconnected_route = Unconnected Route
via = Via
via_count = via count

View File

@ -1,40 +0,0 @@
# German version of the default file with language dependent text
add_corner = Ecke hinzufügen (linke Maustaste)
all = alle
cancel = abbrechen (Esc)
cancel_route = Route abbrechen(Esc)
center_display = Bild zentrieren (c)
change_layer = Lage wechseln
change_layer_tooltip = geht auch mit Zifferntaste oder '+' '-'
close = schließen
color_manager = Farbverwaltung
components = Bauteile
copy = kopieren
done = beenden (Leertaste)
end_route = Route beenden (linke Maustaste)
generate_snapshot = Snapshot erzeugen (s)
incompletes = Offene Verbindungen
inner = innere
insert = einfügen (linke Maustaste)
layer_changed_to = Lage gewechselt nach
layer_visibility = Lagen-Sichtbarkeit
layer_visibility_header = Regler zum Ändern der Sichtbarkeit von Lage
maximum_all = Alle Maximum
maximum_all_tooltip = schiebt alle Regler nach rechts
minimum_all = Alle Minimum
minimum_all_tooltip = schiebt alle Regler nach links
move = verschieben (m)
packages = Packages
padstacks = Padstacks
pick_a_color = Wählen Sie eine Farbe
route_completed = Platine vollständig entflochten
zoom = zoomen
zoom_in = größer (z)
zoom_out = kleiner (o)

View File

@ -1,41 +0,0 @@
# English version of the default file with language dependent text
add_corner = add corner (left button)
all = all
cancel = cancel (Esc)
cancel_route = cancel route (Esc)
center_display = center display (c)
change_layer = change layer
change_layer_tooltip = also possible with number key or '+' '-'
close = close
color_manager = Color Manager
components = Components
copy = copy
done = done (Space)
end_route = end route (left button)
generate_snapshot = generate snapshot (s)
incompletes = Incompletes
inner = inner
insert = insert (left button)
layer_changed_to = layer changed to
layer_visibility = Layer Visibility
layer_visibility_header = Use slider to modify the visibility on layer
maximum_all = Maximum All
maximum_all_tooltip = pushs all sliders to the right
minimum_all = Minimum All
minimum_all_tooltip = pushs all sliders to the left
move = move (m)
packages = Packages
padstacks = Padstacks
pick_a_color = Pick a Color
route_completed = route completed
zoom = zoom
zoom_in = in (z)
zoom_out = out (o)

View File

@ -1,16 +0,0 @@
# German version of language dependent text of the class DisplayMisc
title = Abbildung sonstiges
cross_hair_cursor = Crosshair-Cursor
small = klein
big = groß
cursor_checkbox_tooltip = Shortcut ist die Komma-Taste
rotation = Platinenrotation:
none = keine
90_degree = 90 Grad
180_degree = 180 Grad
-90_degree = -90 Grad
board_mirroring = Platinenspiegelung:
left_right = links rechts
top_bottom = oben unten
layer_dimming = automatisches Lagen-Dimmen:
layer_dimming_tooltip = Mit dem Regler können Sie die Intensität des automatischen Lagen-Dimmens verändern

View File

@ -1,16 +0,0 @@
# English version of language dependent text of the class DisplayMisc
title = Display Miscellaneous
cross_hair_cursor = crosshair cursor
small = small
big = big
cursor_checkbox_tooltip = Shortcut is the comma-key
rotation = eu.mihosoft.freerouting.board rotation:
none = none
90_degree = 90 degree
180_degree = 180 degree
-90_degree = -90 degree
board_mirroring = eu.mihosoft.freerouting.board mirroring:
left_right = left right
top_bottom = top bottom
layer_dimming = automatic layer dimming:
layer_dimming_tooltip = Use slider to change intensity of automatic layer dimming

View File

@ -1,25 +0,0 @@
# German version of language dependent text of the class MainApplication
title = Freerouter
confirm_cancel = Bitte Verlassen des Programms best\u00E4tigen
loading_design = Lade Design
router_demonstrations = Demonstrations-Beispiele
router_demonstrations_tooltip = spiele Demonstrations-Beispiele f\u00FCr den Router ab
sample_designs = Beispiel-Designs
sample_designs_tooltip = Beispiel-Platinen-Designs im Netz \u00F6ffnen
open_own_design = Eigenes Design \u00F6ffnen
open_own_design_tooltip = ein Platinen-Design im Specctra .dsn Format auf der eigenen Festplatte \u00F6ffnen
restore_defaults = System-Defaults wiederherstellen
restore_defaults_tooltip = l\u00F6scht die vom User gespeicherten Einstellungen und stellt die System-Defaults wieder her.
defaults_restored = System-Voreinstellungen wiederhergestellt.
nothing_to_restore = nichts wiederherzustellen
confirm_delete = Bitte das L\u00F6schen der von Ihnen gespeicherten Einstellungen best\u00E4tigen
confirm_import_rules = Bitte das Importieren der gespeicherten Regeln best\u00E4tigen\nBeachten Sie dass dabei aus dem Host-System importierte Regeln \u00FCberschrieben werden k\u00F6nnen
message_3 = kann Platinendesign nicht \u00F6ffnen
message_4 = Design-Datei
message_5 = ge\u00F6ffnet
message_6 = Datei mit Namen
message_7 = nicht gefunden
message_8 = kann Designfile nicht lesen!
user_online_message_1 = Internet Verbindung zum Starten der Freerouter Anwendung erforderlich!
user_online_message_2 = Danach k\u00F6nnen Sie die Verbindung wieder abschalten!

View File

@ -1,25 +0,0 @@
# English version of language dependent text of the class MainApplication
title = Freerouter
confirm_cancel = Please confirm exit
loading_design = Loading design
router_demonstrations = Router Demonstrations
router_demonstrations_tooltip = replay demonstration examples of the router
sample_designs = Sample Designs
sample_designs_tooltip = open example eu.mihosoft.freerouting.board designs in the net
open_own_design = Open Your Own Design
open_own_design_tooltip = open a eu.mihosoft.freerouting.board design in the Specctra .dsn format on your own local disc
restore_defaults = Restore System Defaults
restore_defaults_tooltip = deletes the settings stored by the user and restores the system defaults
defaults_restored = system default settings restored
nothing_to_restore = nothing to restore
confirm_delete = Please confirm deleting your stored settings
confirm_import_rules = Please confirm importing stored eu.mihosoft.freerouting.rules\nBeware that eu.mihosoft.freerouting.rules imported from the the host system may be overwritten
message_3 = unable to open eu.mihosoft.freerouting.board design
message_4 = design file
message_5 = opened
message_6 = File with name
message_7 = not found
message_8 = unable to read design file!
user_online_message_1 = Internet connection required to start the Freerouter application!
user_online_message_2 = After that you can switch the connection off again!

View File

@ -1,9 +0,0 @@
# German version of language dependent text of the class PopupMenuMain
select_item = Objekt selektieren (i)
start_route = Route starten (t)
swap_pin = Pin tauschen (w)
create_keepout = Sperrfläche konstruieren
tile = convexes Polygon
circle = Kreis
polygon = Polygon
hole = Loch

View File

@ -1,9 +0,0 @@
# English version of language dependent text of the class PopupMenuMain
select_item = select item (i)
start_route = start route (t)
swap_pin = swap pin (w)
create_keepout = create keepout
tile = tile
circle = circle
polygon = polygon
hole = hole

View File

@ -1,13 +0,0 @@
# German version of language dependent text of the class PopupMenuMove
turn = drehen
90_degree = 90 Grad (+)
180_degree = 180 Grad (*)
-90_degree = -90 Grad (-)
45_degree = 45 Grad
135_degree = 135 Grad
-135_degree = -135 Grad
-45_degree = -45 Grad
change_side = Seite wechseln(/)
reset_rotation = Rotation zurücksetzen
insert = einfügen (linke Maustaste)
cancel = abbrechen (Esc)

View File

@ -1,13 +0,0 @@
# English version of language dependent text of the class PopupMenuMain
turn = turn
90_degree = 90 degree (+)
180_degree = 180 degree (*)
-90_degree = -90 degree (-)
45_degree = 45 degree
135_degree = 135 degree
-135_degree = -135 degree
-45_degree = -45 degree
change_side = change side (/)
reset_rotation = reset rotation
insert = insert (left button)
cancel = cancel (Esc)

View File

@ -1,7 +0,0 @@
# German version of language dependent text of the class WindowAbout
title = \u00DCber diese Software
description = Freie Software zum Entflechten von Leiterplatten
warranty = Wir \u00FCbernehmen keinerlei Garantie oder Gew\u00E4hrleistung!
version = Version:
homepage = Homepage: http://www.freerouting.net
support = Kontakt: support@freerouting.net

View File

@ -1,7 +0,0 @@
# English version of language dependent text of the class WindowAbout
title = About this software
description = Free software for Printed Circuit Board Routing
version = Version:
warranty = This program comes with absolutely no warranty!
homepage = Homepage: http://www.freerouting.net
support = Contact: support@freerouting.net

View File

@ -1,6 +0,0 @@
# German version of language dependent text of the class WindowAssignNetClass
title = Netzklasse zuweisen
net_name = Netzname
class_name = Klassenname
net_name_tooltip = Der Name des Netzes
class_name_tooltip = Die zugewiesene Netzklasse

View File

@ -1,6 +0,0 @@
# English version of language dependent text of the class WindowAssignNetClass
title = Assign Net Class
net_name = net name
class_name = class name
net_name_tooltip = The net name
class_name_tooltip = The assigned net class

View File

@ -1,25 +0,0 @@
# German version of language dependent text of the class WindowAutorouteParameter
title = Autoroute-Einstellungen
layer = Lage:
active = aktiv:
preferred_direction = Vorzugsrichtung:
horizontal = horizontal
vertical = vertikal
detail_parameter = Detail-Einstellungen
detail_autoroute_parameter = Detailierte Autoroute-Einstellungen
trace_costs_on_layer = Trace-Kosten auf Lage:
in_preferred_direction in Vorzugsrichtung:
against_preferred_direction gegen die Vorzugsrichtung:
with_fanout = Fanout vorrouten:
vias_allowed = Vias erlaubt:
via_costs Via-Kosten:
plane_via_costs Stromlagen-Via-Kosten:
start_ripup_costs = Ripup-Anfangskosten:
start_pass = Start-Pass:
speed = Tempo:
fast = schnell
slow = langsam
passes = Passes:
fanout = Fanout
eu.mihosoft.freerouting.autoroute = Autoroute
postroute = Postroute

View File

@ -1,25 +0,0 @@
# English version of language dependent text of the class WindowRouteParameter
title = Autoroute Parameter
layer = Layer:
active = Active:
preferred_direction = Preferred Direction:
horizontal = horizontal
vertical = vertical
detail_parameter = Detail parameter
detail_autoroute_parameter = Detail Autoroute Parameter
trace_costs_on_layer = Trace costs on layer:
in_preferred_direction In preferred direction:
against_preferred_direction Against preferred direction:
with_fanout = Preroute fanout:
vias_allowed = Vias allowed:
via_costs Via costs:
plane_via_costs Powerplane via costs:
start_ripup_costs = Ripup start costs:
start_pass = Start pass:
speed = Speed:
fast = fast
slow = slow
passes = Passes:
fanout = Fanout
eu.mihosoft.freerouting.autoroute = Autoroute
postroute = Postroute

View File

@ -1,16 +0,0 @@
# English version of language dependent text of the class WindowClearanceClass
title = Clearance-Matrix
layer = Lage:
layer_tooltip = Lage einstellen, wo die die Werte der Clearance-Matrix geändert werden können
add_class = Klasse hinzufügen
add_class_tooltip = Eine neue Clearance-Klasse Klasse hinzufügen
prune = Trimmen
prune_tooltip = Redundante Klassen löschen
new_name = Bitte geben Sie den Namen der neuen Klasse ein
confirm_remove = Bitte bestätigen Sie das Löschen der Klasse
class = Klasse
the_class = der Klasse
the_classes = den Klassen
and = und
already_assigned = Objekte sind schon zugewiesen zu
change_anyway = !\nClearance-Regel trotzdem ändern?

View File

@ -1,16 +0,0 @@
# English version of language dependent text of the class WindowClearanceClass
title = Clearance Matrix
layer = Layer:
layer_tooltip = Set the layer, where the clearance matrix can be changed
add_class = Add Class
add_class_tooltip = Append a new clearance class
prune = Trim
prune_tooltip = Remove redundant classes
new_name = Please enter the name of the new class
confirm_remove = Please confirm removing class
class = class
the_class = the class
the_classes = the classes
and = and
already_assigned = Items already assigned to
change_anyway = !\nChange clearance anyway?

View File

@ -1,14 +0,0 @@
# German version of language dependent text of the class WindowClearanceViolations
title = Clearance-Verletzungen
list_empty_message = keine Verletzungen gefunden
at = bei
on_layer = auf Lage
pin = Pin
via = Via
trace = Bahn
conduction_area = Leitungsfläche
keepout = Sperrfläche
via_keepout = Via-Sperrfläche
component_keepout = Bauteil-Sperrfläche
board_outline = Platinen-Rand
unknown = unbekannt

View File

@ -1,14 +0,0 @@
# English version of language dependent text of the class WindowClearanceViolations
title = Clearance Violations
list_empty_message = no violations found
at = at
on_layer = on layer
pin = pin
via = via
trace = trace
conduction_area = conduction area
keepout = keepout
via_keepout = via keepout
component_keepout = component keepout
board_outline = eu.mihosoft.freerouting.board outline
unknown = unknown

View File

@ -1,15 +0,0 @@
# English version of language dependent text of the class WindowEditVias
title = Vias editieren
add = Hinzufügen
add_tooltip = Ein neues Via hinzufügen
remove = Löschen
remove_tooltip = Das augewählte Via löschen
new_via = neues_via_
via = Via
removed = gelöscht
NAME = Name
PADSTACK = Padstack
CLEARANCE_CLASS = Clearance-Klasse
ATTACH_SMD = SMD-Überlappung
message_1 = letztes Via niccht gelöscht
message_2 = Via nicht gelöscht weil es noch verwendet wird in der Via-Regel

View File

@ -1,15 +0,0 @@
# English version of language dependent text of the class WindowEditVias
title = Edit Vias
add = Add
add_tooltip = Append a new via
remove = Remove
remove_tooltip = Remove the selected via
new_via = new_via_
via = via
removed = removed
NAME = name
PADSTACK = padstack
CLEARANCE_CLASS = clearance class
ATTACH_SMD = attach smd
message_1 = last via not removed
message_2 = via not removed because it is still used in via rule

View File

@ -1,7 +0,0 @@
# German version of language dependent text of the class WindowAbout
title = Längenverletzungen
list_empty = keine Längenverletzungen gefunden
maximum_allowed = maximal erlaubt
minimum_allowed = minimal erlaubt
net = Netz
trace_length = : Bahnlänge

Some files were not shown because too many files have changed in this diff Show More