Source code for furntype.Factory.panel
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: --<alexandr69@gmail.com>
Purpose:
Created: 06/28/21
"""
import typing
from furntype.Factory import factory
from furntype import constants
from furntype import Entities
from furntype import validate_meta as validate
[docs]class PanelRectangleFactory(factory.AbstractEntityFactory):
"""Фабрика прямоугольной параметрической панели
_______________________________________________
args:
- majorplace <MajorplacePanel> -
- length <Quantity> -
- width <Quantity> -
- panmater <Positive> -
- texangle <Positive> -
- b_incise <LogicalBool> -
"""
majorplace = validate.MajorplacePanel(
doc='Тип панели (полка, стойка, стенка)')
length = validate.Quantity(doc='Длина панели')
width = validate.Quantity(doc='Ширина панели')
panmater = validate.Positive(doc='ID материала панели')
texangle = validate.Positive(doc='Направление текстуры')
b_incise = validate.LogicalBool(doc='Признак врезной панели')
[docs] def __init__(self, majorplace = constants.MAJORPLACE.SHELF,
length: float = None, width: float = None,
panmater: float = None, texangle: float = 0, b_incise: bool = False):
self.majorplace = majorplace # Тип панели (полка, стойка, стенка)
self.length = length # Длина панели
self.width = width # Ширина панели
self.panmater = panmater # ID материала панели
self.texangle = texangle # Направление текстуры
# Признак врезной панели - нужно делать пропилы в смежных
self.b_incise: bool = b_incise
self.panelform = constants.PANELFORM.RECTANGLE.value # Форма панели
[docs] def create(self) -> Entities.panel.MbPanel:
return Entities.panel.MbPanel(majorplace = self.majorplace,
length= self.length, width= self.width,
panmater = self.panmater, texangle= self.texangle)
[docs]class PanelView: # DTO
'''представление мебельной панели DataTransferObject'''
[docs] def __init__(self):
self.panel: Entities.panel.MbPanel = None
self.messages: typing.List[str] = []