[英]What design pattern fits this case better
I am to produce a 2D image from a 3D model and do some calculation on the image and produce some results from that. 我要从3D模型生成2D图像,并对图像进行一些计算,并从中得出一些结果。 Results will be attached at the top of that 2D image as its header. 结果将附加在该2D图像的顶部作为其标题。
What design pattern dose fit this case better? 哪种设计模式更适合这种情况?
Would it be better to use abstract class (since there are some common methods which could be inherited) regarding those three diagram types or an Interface? 关于这三种图类型或一个接口,使用抽象类(因为可以继承一些通用方法)会更好吗?
I am mostly concerned with this 'CreateImage' method which can have different signature regarding the method that is used, Such that each digram type would have one 'CreateImage' method regardless of diagram type and rendering method.(Im not sure this would be possible at all). 我最关心的是这个'CreateImage'方法,该方法对于所使用的方法可能具有不同的签名,因此每个图类型都将具有一个'CreateImage'方法,而与图的类型和呈现方法无关。(不确定这是否可能完全没有)。
"Three different xxx vs two different yyy" which depend on each other sounds immediately like the Bridge Pattern to me. 彼此依赖的“三个不同的xxx与两个不同的yyy”听起来像是我的桥接模式。
In other words, you have a hierarchy of xxx, a hierarchy of yyy and xxx accepts injected yyy. 换句话说,您的层次结构为xxx,层次结构为yyy,并且xxx接受注入的yyy。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.