private static final String MAIN_SECTION = "main";
private static final String SELECTION_SECTION = "selection";
private static final String SELECTION_MASK_SECTION = "selectionMask";
-
+
private static final String[] ALL_SECTIONS = { MAIN_SECTION, SELECTION_SECTION, SELECTION_MASK_SECTION };
+ // Changed from 0.001 to 0.0001 to prevent creation of huge BufferedImage's when
+ // generating PDF from SVG. If SVG contains any transparency then Batik uses
+ // bitmap-rendering which remarkably slows things down
+ // See org.apache.batik.gvt.AbstractGraphicsNode.paint(Graphics2D) where decisions are made
+ // if AlphaComposite should be painted
+ private static final String OPACITY = "0.0001";
+
@Deprecated
public static ICanvasSceneGraphProvider getICanvasSceneGraphProvider(Resource model, Resource diagram, String diagramRVI) throws DatabaseException, InterruptedException {
ICanvasSceneGraphProvider provider = DiagramNodeUtil.loadSceneGraphProvider(model, diagram, diagramRVI);
String key = getKey((ConnectionNode) node);
parentBuilder.append(MAIN_SECTION, "\n<g class=\"connection\" id=\"" + key + "\">");
parentBuilder.append(SELECTION_SECTION, "\n<g style=\"visibility:hidden\" class=\"selection\" id=\"" + key + "\">");
- parentBuilder.append(SELECTION_MASK_SECTION, "\n<g class=\"selectionMask\" opacity=\"0.001\" id=\"" + key + "\">");
+ parentBuilder.append(SELECTION_MASK_SECTION, "\n<g class=\"selectionMask\" opacity=\"" + OPACITY + "\" id=\"" + key + "\">");
Element doc = renderSVGNode(svgGenerator, (IG2DNode)node);
String svg = printSVGDocument(doc);
Rectangle2D rect = n.getRect();
// NaN
if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) {
- parentBuilder2.append(SELECTION_MASK_SECTION,"<rect style=\"fill:#fff\" opacity=\"0.001\"");
+ parentBuilder2.append(SELECTION_MASK_SECTION,"<rect style=\"fill:#fff\" opacity=\"" + OPACITY + "\"");
parentBuilder2.append(SELECTION_MASK_SECTION," x=\"" + rect.getX() + "\" y=\"" + rect.getY() + "\"");
parentBuilder2.append(SELECTION_MASK_SECTION," width=\"" + rect.getWidth() + "\" height=\"" + rect.getHeight() + "\"");
parentBuilder2.append(SELECTION_MASK_SECTION,"></rect>");
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
@SuppressWarnings({ "rawtypes", "unchecked" })
public static List<Object> pmap(Function f, List<Object> l) {
- return Arrays.asList(l.parallelStream().map(a -> f.apply(a)).toArray());
+ return l.parallelStream().map(f::apply).collect(Collectors.toList());
}
@SuppressWarnings({ "rawtypes", "unchecked" })
import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler;
import org.simantics.spreadsheet.resource.SpreadsheetResource;
import org.simantics.spreadsheet.util.SpreadsheetUtils;
-import org.simantics.structural.synchronization.Synchronizer;
+import org.simantics.structural.synchronization.client.Synchronizer;
import gnu.trove.iterator.TObjectIntIterator;
import gnu.trove.map.hash.TObjectIntHashMap;
import org.simantics.spreadsheet.graph.formula.SpreadsheetEvaluationEnvironment;
import org.simantics.spreadsheet.graph.synchronization.SpreadsheetSynchronizationEventHandler;
import org.simantics.spreadsheet.resource.SpreadsheetResource;
-import org.simantics.structural.synchronization.Synchronizer;
+import org.simantics.structural.synchronization.client.Synchronizer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.simantics.structural.synchronization.base.ModuleUpdateContext;
import org.simantics.structural.synchronization.base.ModuleUpdaterBase;
import org.simantics.structural.synchronization.base.PropertyUpdateRule;
-import org.simantics.structural.synchronization.utils.Solver;
public class LineUpdater extends ModuleUpdaterBase<SheetLineComponent> {
org.simantics.datatypes.ontology;bundle-version="1.1.0",
org.simantics.structural.synchronization;bundle-version="1.0.0";visibility:=reexport,
org.slf4j.api
-Export-Package: org.simantics.structural.synchronization,
- org.simantics.structural.synchronization.base
+Export-Package: org.simantics.structural.synchronization.client
Automatic-Module-Name: org.simantics.structural.synchronization.client
-package org.simantics.structural.synchronization;
+package org.simantics.structural.synchronization.client;
import java.util.concurrent.ConcurrentMap;
-package org.simantics.structural.synchronization;
+package org.simantics.structural.synchronization.client;
import gnu.trove.map.hash.THashMap;
import gnu.trove.map.hash.TObjectIntHashMap;
-package org.simantics.structural.synchronization;
+package org.simantics.structural.synchronization.client;
import gnu.trove.map.hash.TObjectIntHashMap;
import gnu.trove.set.hash.THashSet;
-package org.simantics.structural.synchronization.base;
+package org.simantics.structural.synchronization.client;
import org.eclipse.core.runtime.IProgressMonitor;
import org.simantics.db.ReadGraph;
Bundle-SymbolicName: org.simantics.structural.synchronization;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.simantics.structural.synchronization.base2,
+Export-Package: org.simantics.structural.synchronization.base,
org.simantics.structural.synchronization.protocol,
org.simantics.structural.synchronization.utils
Require-Bundle: org.simantics.databoard;bundle-version="0.6.5",
package org.simantics.structural.synchronization.base;
-import gnu.trove.map.hash.THashMap;
-
import java.util.ArrayList;
import org.simantics.databoard.binding.mutable.Variant;
import org.simantics.structural.synchronization.utils.ComponentBase;
import org.simantics.structural.synchronization.utils.Solver;
+import gnu.trove.map.hash.THashMap;
+
public class ModuleUpdateContext<T extends ComponentBase<T>> {
private ModuleUpdaterBase<T> updater;
package org.simantics.structural.synchronization.base;
-import gnu.trove.map.hash.THashMap;
-
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.simantics.structural.synchronization.protocol.SerializedVariable;
import org.simantics.structural.synchronization.utils.ComponentBase;
+import gnu.trove.map.hash.THashMap;
+
abstract public class ModuleUpdaterBase<T extends ComponentBase<T>> {
public String moduleType;
package org.simantics.structural.synchronization.base;
-import org.simantics.db.exception.DatabaseException;
import org.simantics.structural.synchronization.utils.ComponentBase;
-
public interface ModuleUpdaterFactoryBase<T extends ComponentBase<T>> {
- public ModuleUpdaterBase<T> createUpdater(String id) throws DatabaseException;
+ public ModuleUpdaterBase<T> createUpdater(String id) throws Exception;
}
package org.simantics.structural.synchronization.base;
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.procedure.TObjectObjectProcedure;
-
import java.util.ArrayList;
import java.util.Collections;
import org.simantics.structural.synchronization.utils.Solver;
import org.slf4j.Logger;
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.procedure.TObjectObjectProcedure;
+
abstract public class ReferenceResolverBase<T extends ComponentBase<T>> {
protected SynchronizationEventHandler eventHandler;
import org.simantics.databoard.Bindings;
import org.simantics.databoard.adapter.AdaptException;
-import org.simantics.db.exception.DatabaseException;
import org.simantics.structural.synchronization.internal.Policy;
import org.simantics.structural.synchronization.protocol.ChildInfo;
import org.simantics.structural.synchronization.protocol.Connection;
ModuleUpdaterBase<T> updater;
try {
updater = moduleUpdaterFactory.createUpdater(id);
- } catch (DatabaseException e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
if(updater == null)
-package org.simantics.structural.synchronization.base2;
+package org.simantics.structural.synchronization.protocol;
import gnu.trove.map.hash.THashMap;
import gnu.trove.set.hash.THashSet;
import java.util.Map;
import org.simantics.databoard.util.URIStringUtils;
-import org.simantics.structural.synchronization.protocol.ChildInfo;
-import org.simantics.structural.synchronization.protocol.Connection;
-import org.simantics.structural.synchronization.protocol.SerializedVariable;
-import org.simantics.structural.synchronization.protocol.SynchronizationEventHandler;
-import org.simantics.structural.synchronization.protocol.SynchronizationException;
/**
* <p>A partial implementation of SynchronizationEventHandler that contains all generic