Tuukka Lehtonen [Thu, 16 Jan 2020 10:44:10 +0000 (12:44 +0200)]
Fixed argument passing in async/sync read/write SCL functions
These arguments haven't really been used in SCL code invoking syncRead,
syncWrite, asyncRead or asyncWrite which is why these have gone
unnoticed for quite long.
Tuukka Lehtonen [Fri, 3 Jan 2020 11:51:33 +0000 (13:51 +0200)]
Added new field TypeId to dependency index for exact type searching
The new field is String-valued and contains a concatenation of the
resource ids of a resource's type hierarchy, separated by a whitespace,
for example `41233 12423 1233`. This field uses the WhitespaceAnalyzer,
i.e. its contents are tokenized by whitespace and thus searches like
`TypeId:41233` will return exactly those resources that are instances of
the type resource `41233`.
This commit also simplifies and fixes some of the existing index
searching code to use this new field instead of the old `Types` field
for type-based searching.
If existing product-code uses the indexing facilities directly and not
through `QueryIndexUtils` or `Instances`, such code will also require
changes to take this new field into use.
See `IndexQueries` to form queries related to this field.
Tuukka Lehtonen [Fri, 20 Dec 2019 11:15:56 +0000 (13:15 +0200)]
Limit SCL Console buffer size to 5M characters by default
Low watermark limit for the buffer size can be configured from the new
SCL / Console preference page. High watermark is always set to 100 80
character rows larger than the low watermark.
Buffer size limiting can also be disabled/enabled entirely from the same
preference page.
Ontology cannot be compiled if it depends on a tg that has another name
than graph.tg. Fixed this by searching for all .tg files instead of
those called graph.tg.
Previously nodes could only return null to say "I have no bounds".
Now it is possible to return GeometryUtils.undefinedBounds() to say
"ignore my bounds" to G2DParentNode.
Also allow customization of the node class used by ElementPainter to
mark selections under "element nodes" through a new configuration class
ElementPainterConfiguration.
This allows e.g. district to use its own node for this purpose to
optimize the scene graph and customize the bounds it returns.
Tuukka Lehtonen [Mon, 4 Nov 2019 14:12:08 +0000 (16:12 +0200)]
Removed trailing newline from clipboard text
When copying text to clipboard from GraphExplorer-based UI controls
(Model Browser, Selection view) using StandardCopyHandler, the produced
text no longer contains a trailing newline.
Jussi Koskela [Thu, 31 Oct 2019 13:52:35 +0000 (15:52 +0200)]
Fixed two problems in connecting picking
Tolerance was incorrectly subtracted instead of added in RouteLine
picking. RouteGraphConnectionClass did not take selection stroke width
into account when doing coarse picking based on bounding box.
jsimomaa [Thu, 31 Oct 2019 07:27:35 +0000 (09:27 +0200)]
Fix adding components to configurationBySolverName map in MappingBase
The map is now invalidated (= null) when components are added which
means the map will be recalculated next time when retrieved with
getConfigurationBySolverName.
Tuukka Lehtonen [Tue, 29 Oct 2019 14:42:11 +0000 (16:42 +0200)]
Support reading TG files with shared and non-shared value contexts
This is part of the fix for a nasty corner case in
TransferableGraphFileReader.readTG's deserialization of referable value
data types.
This regression was caused by commit bf495713dbc9dec325f3929889466fa6cd58b541 over 1.5 years ago. The removal
of idContext.clear() was done without proper understanding of the real
issue.
The real issue is that TG's are currently written in two ways by
different codes: with shared and with non-shared value contexts.
Serializing TransferableGraph1 structures using the default Binding will
use shared context for serializing the values Variant array. Thus all TG
files produced by the graph compiler use a shared value context which
eans this class must be used with sharedValueContext set to true. As an
example, <code>true</code> must be used if the corresponding TG file is
written e.g. like this:
DataContainers.writeFile(location
new DataContainer(format,
version,
metadata,
new Variant(TransferableGraph1.BINDING, tg)));
On the other hand, any TG files serialized using more optimized methods
like ModelTransferableGraphSource do not use a shared value context when
writing the file. This means those files cannot be read safely using
standard {@link Binding} at all, and when using this class,
sharedValueContext must be set to false to prevent the import from
corrupting datatype values because the referable parts of datatypes may
get bound to the wrong existing types if the data is read using shared
context.
After this change clients should use readTG(File | InputStream, boolean)
methods instead of readTG to always specify the context sharing setting
explicitly according to how the TG's in question were written.
Jussi Koskela [Tue, 29 Oct 2019 12:04:28 +0000 (14:04 +0200)]
Take zoom level into account when picking connections
Also fixed RouteGraphConnectTool.pickNearestRouteGraphConnection which
gave flawed results. Visual hints are fixed to match the performed
actions. This versions always picks the closest connection if there are
multiple hits.
Tuukka Lehtonen [Tue, 29 Oct 2019 10:55:05 +0000 (12:55 +0200)]
Moved RouteGraphConnectionClass to org.simantics.g2d.elementclass
Previously the class was in bundle org.simantics.diagram, which depends
on database bundles and other things that RouteGraphConnectionClass does
not need or use.
In #396 the RouteGraphConnectionClass.KEY_RG_NODE would be needed in
org.simantics.g2d and therefore it makes sense to move it there.
Tuukka Lehtonen [Thu, 17 Oct 2019 07:52:39 +0000 (10:52 +0300)]
Rid TypicalPropertyTester of database read transactions
After this, the normal workbench invocations of TypicalPropertyTester no
longer perform any database transactions to do their work. DiagramViewer
now has built-in support for doing the required queries based on
IDiagram hints alone.
1. Grid values were not rendered properly when the [yMin,yMax] interval
gets too small (under 1e-6). The calculations in
GridSpacing.makeGridSpacing contain a capping logic for parameter
viewboxSize which doesn't necessarily have to be there (IMHO). The
problem is essentially that auto-scaling the Y-axis allows zooming to
any small value interval, but the vertical ruler rendering just
doesn't work properly in those cases.
2. GridUtil.calcLabelWidth calculated the rendered Y-value labels
differently from the rendering logic in GridUtil.paintVerticalRuler
and GridUtil.paintVerticalSlaveRuler, i.e. in a more inprecise manner
which results in the y-axis reserved width not following properly
what is rendered.
Added two new user component SCL script simulation stages
1. pre-step: executed during each simulation step,
before native simulation stepping
2. post-step: executed during each simulation step,
after native and all other stepping logics
The purpose of these is to allow simulation step initialization and
finalization with UC SCL scripts.
Allow simulation stop handling in Simantics/Sequences
`StopReason` enumerates supported reasons for simulation stops which is
delivered once to functions registered through `executeWhenStopped`.
It is up to the domain-specific sequence runners to implement the actual
identification of simulation stopping situations and to invoke
AbstractActionContext.stop(StopReason reason) when needed.
Jussi Koskela [Thu, 5 Sep 2019 10:06:16 +0000 (13:06 +0300)]
Improved the positioning of issue decoration for connection elements
Shows the issue decorator at a point that belongs to the connection and
is closest to the center of its bounding box. Also fixed the updating of
position.