Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BraillePlot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Georg Graßnick
BraillePlot
Commits
e5e17df5
Commit
e5e17df5
authored
5 years ago
by
Andrey Ruzhanskiy
Browse files
Options
Downloads
Patches
Plain Diff
Added new method for length of braille
parent
3ccb1048
No related branches found
No related tags found
1 merge request
!24
Feat/brailletextrasterizer 38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tudresden/inf/mci/brailleplot/rendering/LiblouisBrailleTextRasterizer.java
+18
-1
18 additions, 1 deletion
.../brailleplot/rendering/LiblouisBrailleTextRasterizer.java
with
18 additions
and
1 deletion
src/main/java/de/tudresden/inf/mci/brailleplot/rendering/LiblouisBrailleTextRasterizer.java
+
18
−
1
View file @
e5e17df5
...
@@ -45,7 +45,7 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
...
@@ -45,7 +45,7 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
}
}
try
{
try
{
mTranslator
=
new
Translator
(
"src\\main\\resources\\mapping\\liblouis\\de-g
0.u
tb"
);
mTranslator
=
new
Translator
(
"src\\main\\resources\\mapping\\liblouis\\de-g
1.c
tb"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
.
getCause
());
throw
new
RuntimeException
(
e
.
getCause
());
}
}
...
@@ -56,6 +56,9 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
...
@@ -56,6 +56,9 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
public
void
rasterize
(
final
BrailleText
data
,
final
RasterCanvas
canvas
)
throws
InsufficientRenderingAreaException
{
public
void
rasterize
(
final
BrailleText
data
,
final
RasterCanvas
canvas
)
throws
InsufficientRenderingAreaException
{
Objects
.
requireNonNull
(
data
,
"The data given to the brailletextrasterizer was null!"
);
Objects
.
requireNonNull
(
data
,
"The data given to the brailletextrasterizer was null!"
);
Objects
.
requireNonNull
(
canvas
,
"The canvas given to the brailletextrasterizer was null!"
);
Objects
.
requireNonNull
(
canvas
,
"The canvas given to the brailletextrasterizer was null!"
);
if
(
data
.
getText
()
==
""
)
{
throw
new
RuntimeException
(
"The string in the Brailletext must not be empty!"
);
}
Rectangle
rect
=
data
.
getArea
().
intersectedWith
(
canvas
.
getDotRectangle
());
Rectangle
rect
=
data
.
getArea
().
intersectedWith
(
canvas
.
getDotRectangle
());
mCanvas
=
canvas
;
mCanvas
=
canvas
;
TranslationResult
result
=
null
;
TranslationResult
result
=
null
;
...
@@ -149,4 +152,18 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
...
@@ -149,4 +152,18 @@ public class LiblouisBrailleTextRasterizer implements Rasterizer<BrailleText> {
}
}
return
(
int
)
ceil
((
double
)
widthOfText
/
(
double
)
tempMaxWidth
);
return
(
int
)
ceil
((
double
)
widthOfText
/
(
double
)
tempMaxWidth
);
}
}
public
int
getBrailleStringLength
(
String
text
)
{
Objects
.
requireNonNull
(
text
,
"The given string for getBrailleStringLength was null!"
);
if
(
text
==
""
)
return
0
;
TranslationResult
result
=
null
;
try
{
result
=
mTranslator
.
translate
(
text
,
null
,
null
,
null
,
DisplayTable
.
StandardDisplayTables
.
DEFAULT
);
}
catch
(
TranslationException
e
)
{
e
.
printStackTrace
();
}
catch
(
DisplayException
e
)
{
e
.
printStackTrace
();
}
return
result
.
getBraille
().
length
();
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment