Conversation
Renamed angle to X. Made angle change all the time.
| } | ||
| public void drawTruck(int x3, int y3, double angleToXAxis, Graphics g) | ||
| { | ||
| //files taken from http://hdimagelib.com/trailer+truck+top+view |
There was a problem hiding this comment.
What is the license they are available with?
There was a problem hiding this comment.
No idea about licences available with them. I took it from their website. Sent from my BlackBerry 10 smartphone on the EE network. From: Alexander CherednichenkoSent: Sunday 20 March 2016 23:07To: teamIndexZero/index_zero_trafficsystemReply To: teamIndexZero/index_zero_trafficsystemCc: kumar awijeetSubject: Re: [index_zero_trafficsystem] Gui graphics kumar awijeet (#9)In gui/src/main/java/kcl/teamIndexZero/traffic/gui/GUI_Primitives.java:
- }
- public void drawCurve(int x1, int y1, int x2, int y2, int ctrlx, int ctrly, Graphics g) {
Graphics2D g2 = (Graphics2D) g;QuadCurve2D q = new QuadCurve2D.Float();q.setCurve(x1, y1, ctrlx, ctrly, x2, y2);g2.draw(q);- }
- public void drawSingleRoad(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3, Graphics g) {
drawLine(x, y, x1, y1, g);drawLine(x2, y2, x3, y3, g);- }
- public void drawTruck(int x3, int y3, double angleToXAxis, Graphics g)
- {
//files taken from http://hdimagelib.com/trailer+truck+top+view
What is the license they are available with?
—You are receiving this because you authored the thread.Reply to this email directly or view it on GitHub
There was a problem hiding this comment.
The image must have a proper license that allows at least academic use. Please check and put the relevant information in the report.
There was a problem hiding this comment.
I will try to find that, but if it's not there, can we still use it? There is a © on the second picture but other than that found nothing as to what you are asking. Sent from my BlackBerry 10 smartphone on the EE network. From: EsSent: Monday 21 March 2016 01:11To: teamIndexZero/index_zero_trafficsystemReply To: teamIndexZero/index_zero_trafficsystemCc: kumar awijeetSubject: Re: [index_zero_trafficsystem] Gui graphics kumar awijeet (#9)In gui/src/main/java/kcl/teamIndexZero/traffic/gui/GUI_Primitives.java:
- }
- public void drawCurve(int x1, int y1, int x2, int y2, int ctrlx, int ctrly, Graphics g) {
Graphics2D g2 = (Graphics2D) g;QuadCurve2D q = new QuadCurve2D.Float();q.setCurve(x1, y1, ctrlx, ctrly, x2, y2);g2.draw(q);- }
- public void drawSingleRoad(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3, Graphics g) {
drawLine(x, y, x1, y1, g);drawLine(x2, y2, x3, y3, g);- }
- public void drawTruck(int x3, int y3, double angleToXAxis, Graphics g)
- {
//files taken from http://hdimagelib.com/trailer+truck+top+view
The image must have a proper license that allows at least academic use. Please check and put the relevant information in the report.
—You are receiving this because you authored the thread.Reply to this email directly or view it on GitHub
There was a problem hiding this comment.
I will try to find that, but if it's not there, can we still use it?
basically no.
As soon as its license is not defined, we can not use it. License is a kind of ephemeral transfer of some rights, either paid or under special circumstances (viral GPL for example). Using something without a license leads to https://en.wikipedia.org/wiki/Copyright_infringement
We all know it is a group project, but doing something like that may lead to a) marks being lowered b) generally is a bad practice. Even if copyright is not stated in the originating document/page by author.
|
@kumarawijeet that is what I'm getting when trying to run your branch. Suggest that image files are not committed/pushed/added to pull request? |
java.io.FileNotFoundException: gui/src/main/resources/sprites/bmw_z_top_view_clip_art_18132.jpg (No such file or directory) —You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub |
|
java.io.FileNotFoundException: gui/src/main/resources/sprites/bmw_z_top_view_clip_art_18132.jpg (No such file or directory) —You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub |
Removed the color change to black, so now the primitive doesn't decide the color of graphics. The pictures should push but don't know why it's not happening. Any help on this will be great!
|
@kumarawijeet right click and "add to VCS" on the brown files. Then commit/push |
—You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub |
java.io.FileNotFoundException: gui/src/main/resources/sprites/bmw_z_top_view_clip_art_18132.jpg (No such file or directory) —You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub |
…le is as I got it from the master. Alex hope this solves your problem of maps, if not let me know what more I can do to not destroy the map.
…troy the main maps.
# Conflicts: # gui/src/main/java/kcl/teamIndexZero/traffic/gui/SimulationImageProducer.java # gui/src/main/java/kcl/teamIndexZero/traffic/gui/SimulatorGui.java # gui/src/main/java/kcl/teamIndexZero/traffic/gui/components/MapPanel.java
…taken is some 150 ms. Have used basic if and else statements to reduce the read time, along with some extra variables. GUIPrimitivesTest is the test used to check the above results. TODO add logs for various other exceptions, will go for it tomorrow.
…taken is some 150 ms. Have used basic if and else statements to reduce the read time, along with some extra variables. GUIPrimitivesTest is the test used to check the above results. TODO add logs for various other exceptions, will go for it tomorrow.
| newTransformation.rotate(angleToXAxis, x3, y3); | ||
| graphics.setTransform(newTransformation); | ||
| //InputStream imageStream; | ||
| if ((filename == "gui/src/main/resources/sprites/bmw_z_top_view_clip_art_18132.jpg") && (k == 0)) { |
There was a problem hiding this comment.
You got the point!
It should be faster now.
Instead of using extra variable for the flag, you could do much easier thing: check if the image itself is null or not. I.e.:
public class Primitives {
...
private Image image1 = null;
...
public drawCar(..., filename ) {
if(image1 == null && filename = "/...car.png" ) {
... load image and file
image1 = ImageIO.read(...)
}
graphics.draw(... image);
}
However, you will need to maintain separate variable for each of the image, and check if filename == one or another. What you could do instead, is use Map<String, Image>, such as HashMap, to use store corresponding pairs of Path --> Image object, and the code would be like:
public class Primitives {
private Map<String, BufferedImage> imageCache = new HashMap<>();
...
public void drawCar(..., filename) {
if(!imageCache.containsKey(filename)) {
// load image,
BufferedImage im = ImageIO.read(...)
imageCache.put(filename, im);
}
im = imageCache.get(filename) // we are sure now that it exists, as if it would have not, we would have already loaded it
graphics.drawImage(im);
}
Does that make sense?
There was a problem hiding this comment.
No it makes no sense!!! Lol!!The flag, well your thing is also applicable and yeah we can switch to just checking null value.There is no need to use a variable to check for file names. Just say filename == "address of file". Using a hash map will not be leading to improvement in speed, at least that's what I think. Your comments are not completely understandable on phone, so maybe I am wrong, let me have a look on comp tomorrow, and get back to you. Sent from my BlackBerry 10 smartphone on the EE network. From: Alexander CherednichenkoSent: Friday 25 March 2016 19:59To: teamIndexZero/index_zero_trafficsystemReply To: teamIndexZero/index_zero_trafficsystemCc: kumar awijeetSubject: Re: [index_zero_trafficsystem] Gui graphics kumar awijeet (#9)In gui/src/main/java/kcl/teamIndexZero/traffic/gui/GUI_Primitives.java:
- }
- private void drawCar(int x3, int y3, double angleToXAxis, String filename, Graphics g) {
/*Files taken fromhttp://all-free-download.com/free-vector/car-vector-top-view-download.htmlhttp://hdimagelib.com/trailer+truck+top+view*/Graphics2D graphics = (Graphics2D) g;AffineTransform originalTransform = graphics.getTransform();try {AffineTransform newTransformation = new AffineTransform();newTransformation.rotate(angleToXAxis, x3, y3);graphics.setTransform(newTransformation);//InputStream imageStream;if ((filename == "gui/src/main/resources/sprites/bmw_z_top_view_clip_art_18132.jpg") && (k == 0)) {
You got the point!
It should be faster now.
Instead of using extra variable for the flag, you could do much easier thing: check if the image itself is null or not. I.e.:
public class Primitives {
...
private Image image1 = null;
...
public drawCar(..., filename ) {
if(image1 == null && filename = "/...car.png" ) {
... load image and file
image1 = ImageIO.read(...)
}
graphics.draw(... image);
}
However, you will need to maintain separate variable for each of the image, and check if filename == one or another. What you could do instead, is use Map<String, Image>, such as HashMap, to use store corresponding pairs of Path --> Image object, and the code would be like:
public class Primitives {
private Map<String, BufferedImage> imageCache = new HashMap<>();
...
public void drawCar(..., filename) {
if(!imageCache.containsKey(filename)) {
// load image,
BufferedImage im = ImageIO.read(...)
imageCache.put(filename, im);
}
im = imageCache.get(filename) // we are sure now that it exists, as if it would have not, we would have already loaded it
graphics.drawImage(im);
}
Does that make sense?
—You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub
There was a problem hiding this comment.
Alex tried your image == null check, and somehow it takes the time back up, so it's better to leave it with the flags. I think this system works properly with respect to time, let it be that way, let's see other components, like I wanted to check if the flags were actually working, so will create a test for them and check that. Plus we also have to add logging for other exceptions. Also finish the finally branch. So let us see those sections. Moreover, it's not like this code isn't working, so my suggestion is let's wrap it up and finish the rest so that we are able to get it merged and give time to report and other miscellaneous things as well. Sent from my BlackBerry 10 smartphone on the EE network. From: Alexander CherednichenkoSent: Friday 25 March 2016 19:59To: teamIndexZero/index_zero_trafficsystemReply To: teamIndexZero/index_zero_trafficsystemCc: kumar awijeetSubject: Re: [index_zero_trafficsystem] Gui graphics kumar awijeet (#9)In gui/src/main/java/kcl/teamIndexZero/traffic/gui/GUI_Primitives.java:
- }
- private void drawCar(int x3, int y3, double angleToXAxis, String filename, Graphics g) {
/*Files taken fromhttp://all-free-download.com/free-vector/car-vector-top-view-download.htmlhttp://hdimagelib.com/trailer+truck+top+view*/Graphics2D graphics = (Graphics2D) g;AffineTransform originalTransform = graphics.getTransform();try {AffineTransform newTransformation = new AffineTransform();newTransformation.rotate(angleToXAxis, x3, y3);graphics.setTransform(newTransformation);//InputStream imageStream;if ((filename == "gui/src/main/resources/sprites/bmw_z_top_view_clip_art_18132.jpg") && (k == 0)) {
You got the point!
It should be faster now.
Instead of using extra variable for the flag, you could do much easier thing: check if the image itself is null or not. I.e.:
public class Primitives {
...
private Image image1 = null;
...
public drawCar(..., filename ) {
if(image1 == null && filename = "/...car.png" ) {
... load image and file
image1 = ImageIO.read(...)
}
graphics.draw(... image);
}
However, you will need to maintain separate variable for each of the image, and check if filename == one or another. What you could do instead, is use Map<String, Image>, such as HashMap, to use store corresponding pairs of Path --> Image object, and the code would be like:
public class Primitives {
private Map<String, BufferedImage> imageCache = new HashMap<>();
...
public void drawCar(..., filename) {
if(!imageCache.containsKey(filename)) {
// load image,
BufferedImage im = ImageIO.read(...)
imageCache.put(filename, im);
}
im = imageCache.get(filename) // we are sure now that it exists, as if it would have not, we would have already loaded it
graphics.drawImage(im);
}
Does that make sense?
—You are receiving this because you were mentioned.Reply to this email directly or view it on GitHub
Also a few changes in final block to improve functionality.
Also a few changes in final block to improve functionality.
The print statement is removed. Catch block is still single, with the use of instanceof for distinguishing the exceptions. The closure of image stream is still done as previously.
… GUI_Graphics_Kumar_Awijeet
The graphics parameter can't be passed somehow, and am unsure about the placement of the function call The variable GeoPoint is, I think correctly being extracted for x and y coordinates.
… GUI_Graphics_Kumar_Awijeet
The result is not visible on map though, don't know why. Every call has to be under try and catch for some reason unknown to me. The end result on the map is the circle of the cars, being removed, but my cars not being there.
The result is not visible on map though, don't know why. Every call has to be under try and catch for some reason unknown to me. The end result on the map is the circle of the cars, being removed, but my cars not being there.
Added try and catch to remove errors. Added log for try and catch in SimulationImageProducer Changed the graphics to graphics2d

No description provided.