Commit 860cbc5f authored by Andrey Filippov's avatar Andrey Filippov

Updated for synchronized methods in growing lists, regeneration of

intersecting meshes after restoring from files.
parent d35ccbb6
...@@ -27,6 +27,7 @@ package com.elphel.imagej.tileprocessor.lwoc; ...@@ -27,6 +27,7 @@ package com.elphel.imagej.tileprocessor.lwoc;
import java.util.ArrayList; import java.util.ArrayList;
public class LwocLeaf { public class LwocLeaf {
private static final long serialVersionUID = 1L;
ArrayList <LwocMesh> meshes; ArrayList <LwocMesh> meshes;
ArrayList <LwocMesh> mesh_centers; ArrayList <LwocMesh> mesh_centers;
ArrayList <LwocScene> scenes; ArrayList <LwocScene> scenes;
...@@ -36,21 +37,43 @@ public class LwocLeaf { ...@@ -36,21 +37,43 @@ public class LwocLeaf {
scenes = new ArrayList <LwocScene>(); // cameras located in this node scenes = new ArrayList <LwocScene>(); // cameras located in this node
} }
public void addScene(LwocScene scene, public void initMeshes() {
meshes = new ArrayList <LwocMesh>(); // all meshes BB intersecting this node
}
public synchronized void addScene( // IS synchronized needed?
LwocScene scene,
boolean check_existed) { boolean check_existed) {
if (!check_existed || !scenes.contains(scene)) { if (!check_existed || !scenes.contains(scene)) {
scenes.add(scene); scenes.add(scene);
} }
} }
public void addMeshCenter(LwocMesh mesh, public synchronized void addMeshCenter( // IS synchronized needed?
LwocMesh mesh,
boolean check_existed) { boolean check_existed) {
if (!check_existed || !mesh_centers.contains(mesh)) { if (!check_existed || !mesh_centers.contains(mesh)) {
mesh_centers.add(mesh); mesh_centers.add(mesh);
} }
} }
public void addMesh(LwocMesh mesh, public synchronized void removeScene(
LwocScene scene) {
while (scenes.remove(scene)); // will remove all
}
public synchronized void removeMeshCenter(
LwocMesh mesh) {
while (mesh_centers.remove(mesh)); // will remove all
}
public synchronized void removeMesh(
LwocMesh mesh) {
while (meshes.remove(mesh)); // will remove all
}
public synchronized void addMesh( // synchronized IS needed
LwocMesh mesh,
boolean check_existed) { boolean check_existed) {
if (!check_existed || !meshes.contains(mesh)) { if (!check_existed || !meshes.contains(mesh)) {
meshes.add(mesh); meshes.add(mesh);
......
...@@ -28,6 +28,7 @@ import java.util.ArrayList; ...@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
public class LwocMesh { public class LwocMesh {
private static final long serialVersionUID = 1L;
static AtomicInteger MESH_ID = new AtomicInteger(); static AtomicInteger MESH_ID = new AtomicInteger();
static ArrayList<LwocMesh> LWOC_MESHES; static ArrayList<LwocMesh> LWOC_MESHES;
int id; // assign unique ID int id; // assign unique ID
......
...@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.tileprocessor.GeometryCorrection; import com.elphel.imagej.tileprocessor.GeometryCorrection;
public class LwocScene { public class LwocScene {
private static final long serialVersionUID = 1L;
static AtomicInteger SCENE_ID = new AtomicInteger(); static AtomicInteger SCENE_ID = new AtomicInteger();
static ArrayList<LwocScene> LWOC_SCENES; static ArrayList<LwocScene> LWOC_SCENES;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment