Skip to content

Commit

Permalink
Adding tessalation
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jul 30, 2024
1 parent 5243886 commit 5e6c424
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion JCSG
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ repositories {

dependencies {

api 'com.neuronrobotics:JavaCad:1.5.2'
api 'com.neuronrobotics:JavaCad:1.5.3'
api project('java-bowler')
api project('GithubPasswordManager:GithubPasswordManager')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Random;

Expand Down Expand Up @@ -93,7 +94,11 @@ public List<CSG> addOpperation(ICaDoodleOpperation op) {
}
private void storeResultInCache(ICaDoodleOpperation op, List<CSG> process) {
ArrayList<CSG> cachedCopy = new ArrayList<CSG>();
HashSet<String> names = new HashSet<>();
for(CSG c:process) {
if(names.contains(c.getName()))
throw new RuntimeException("There can not be 2 objects with the same name after an opperation!");
names.add(c.getName());
cachedCopy.add(c.clone().setStorage(new PropertyStorage()).syncProperties(c).setName(c.getName()));
}
cache.put(op,cachedCopy);
Expand Down Expand Up @@ -154,7 +159,7 @@ public CaDoodleFile setProjectName(String projectName) {
public String toJson() {
return gson.toJson(this);
}
public File save() throws IOException {
public synchronized File save() throws IOException {
File ret = self==null?File.createTempFile(DownloadManager.sanitizeString(projectName), ".doodle"):self;
String contents = toJson();
FileUtils.write(ret, contents,StandardCharsets.UTF_8, false);
Expand Down

0 comments on commit 5e6c424

Please sign in to comment.